function execConnectedQuery(sql, task, callback) {
    if (_connect) {
        DB.query(sql, task, callback);
    } else {
        if (_options) {
            var connect = mysql.createConnection({
                host: _options['host'],
                port: _options['port'],
                user: _options['user'],
                password: _options['password'],
                database: _options['db'],
                charset: 'utf8'
            });
            connect.connect(function (err) {
                if (err) {
                    callback(err);
                    return;
                }
                _connect = connect;
                DB.query(sql, task, callback);
            });
            connect.on('error', function () {
                _connect = null;
                callback(err);
            });
        } else {
            callback('options is null');
        }
    }
}
/**
 * execute sql by the orm-connected check.
 *
 * @param sql
 * @param task
 * @param callback
 */
execute sql by the orm-connected check.
execute sql by the orm - connected check .
function execConnectedQuery(sql, task, callback) {
    if (_connect) {
        DB.query(sql, task, callback);
    } else {
        if (_options) {
            var connect = mysql.createConnection({
                host: _options['host'],
                port: _options['port'],
                user: _options['user'],
                password: _options['password'],
                database: _options['db'],
                charset: 'utf8'
            });
            connect.connect(function (err) {
                if (err) {
                    callback(err);
                    return;
                }
                _connect = connect;
                DB.query(sql, task, callback);
            });
            connect.on('error', function () {
                _connect = null;
                callback(err);
            });
        } else {
            callback('options is null');
        }
    }
}
function execConnectedQuery ( sql , task , callback ) { if ( _connect ) { DB . query ( sql , task , callback ) ; } else { if ( _options ) { var connect = mysql . createConnection ( { host : _options [ 'host' ] , port : _options [ 'port' ] , user : _options [ 'user' ] , password : _options [ 'password' ] , database : _options [ 'db' ] , charset : 'utf8' } ) ; connect . connect ( function ( err ) { if ( err ) { callback ( err ) ; return ; } _connect = connect ; DB . query ( sql , task , callback ) ; } ) ; connect . on ( 'error' , function ( ) { _connect = null ; callback ( err ) ; } ) ; } else { callback ( 'options is null' ) ; } } }
execute sql by the orm-connected check.
execute sql by the orm - connected check .