/**
 * Created by Administrator on 2017/8/15.
 */
const config = require('doohanpub').config;
const dbConfig=config.get('dbConfig')
const mysql = require('mysql');
var pool = mysql.createPool(dbConfig);

// 内网地址:rm-bp1272001633qc0x9.mysql.rds.aliyuncs.com
// 外网地址:rm-bp1272001633qc0x9o.mysql.rds.aliyuncs.com
// hexin
// gYUHszn9#q

function query(sql,params, callback) {
    pool.getConnection(function (err, connection) {

        if(err){
            console.error(err);
            callback(err);
            return;
        }
        connection.query(sql,params, function (err, rows) {
            connection.release();//释放链接
            callback(err, rows);
        });
    });
}
exports.DBQUERY = query;
