wrapper.js
function wrapConnection(conn) {
    // Already wrapped this function?
    if (conn._coWrapped) {
        return conn;
    }
        
    // Set flag to avoid re-wrapping
    conn._coWrapped = true;

    // Functions to thunkify
    var queryMethods = [
        'query',
        'execute'
    ];
    
    // Traverse query methods list
    queryMethods.forEach(function(name) {
        // Thunkify the method
        conn[name] = wrapQueryMethod(conn[name], conn);
    });
    
    // Return co-friendly connection
    return conn;
}
function wrapConnection(conn) {
    // Already wrapped this function?
    if (conn._coWrapped) {
        return conn;
    }
        
    // Set flag to avoid re-wrapping
    conn._coWrapped = true;

    // Functions to thunkify
    var queryMethods = [
        'query',
        'execute'
    ];
    
    // Traverse query methods list
    queryMethods.forEach(function(name) {
        // Thunkify the method
        conn[name] = wrapQueryMethod(conn[name], conn);
    });
    
    // Return co-friendly connection
    return conn;
}
function wrapConnection ( conn ) { // Already wrapped this function? if ( conn . _coWrapped ) { return conn ; } // Set flag to avoid re-wrapping conn . _coWrapped = true ; // Functions to thunkify var queryMethods = [ 'query' , 'execute' ] ; // Traverse query methods list queryMethods . forEach ( function ( name ) { // Thunkify the method conn [ name ] = wrapQueryMethod ( conn [ name ] , conn ) ; } ) ; // Return co-friendly connection return conn ; }
Wrap a MySQL connection object's query methods
Wrap a MySQL connection object s query methods