nl_tokens: Add a multiple rows to the table - OK / * createEach : function ( connectionName table valuesList cb ) { if ( LOG_DEBUG ) { console . log ( BEGIN createEach ) ; }
pl_tokens: function ( connectionName , table , options , cb ) { if ( LOG_DEBUG ) { console . log ( "BEGIN count" ) ; } // Grab Connection Schema var schema = { } ; var connectionObject = connections [ connectionName ] ; var collection = connectionObject . collections [ table ] ; Object . keys ( connectionObject . collections ) . forEach ( function ( coll ) { schema [ coll ] = connectionObject . collections [ coll ] . schema ; } ) ; // Build Query var _schema = connectionObject . schema ; var processor = new Processor ( _schema ) ; // Mixin WL Next connection overrides to sqlOptions var overrides = connectionOverrides [ connectionName ] || { } ; var _options = _ . cloneDeep ( sqlOptions ) ; if ( hop ( overrides , 'wlNext' ) ) { _options . wlNext = overrides . wlNext ; } var sequel = new Sequel ( _schema , _options ) ; var _query ; // Build a query for the specific query strategy try { _query = sequel . count ( table , options ) ; } catch ( e ) { return cb ( e ) ; } // Run Query connectionObject . pool . getConnection ( function ( err , connection ) { if ( err ) { handleQueryError ( err , 'count' ) ; return ; } if ( LOG_QUERIES ) { console . log ( 'Executing query: ' + _query . query [ 0 ] ) ; } connection . execute ( _query . query [ 0 ] , _query . values [ 0 ] , { outFormat : oracledb . OBJECT } , function __COUNT__ ( err , result ) { if ( err ) { /* Release the connection back to the connection pool */ doRelease ( connection ) ; return cb ( handleQueryError ( err , 'count' ) ) ; } if ( ! _ . isArray ( result . rows ) || ! result . rows . length ) { return cb ( new Error ( 'Invalid query, no results returned.' ) ) ; } var count = <mask> . rows [ 0 ] && result . rows [ 0 ] . count ; /* Release the connection back to the connection pool */ doRelease ( connection ) ; return cb ( null , Number ( count ) ) ; } ) ; } ) ; }