lib/adapter.js
function(connectionName, table, options, cb) {
            if (LOG_DEBUG) {
                console.log("BEGIN destroy");
            }
            
            var connectionObject = connections[connectionName];
            var collection = connectionObject.collections[table];

            var _schema = connectionObject.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.destroy(table, options);
            } catch (e) {
                return cb(e);
            }

            query.query = query.query.replace('RETURNING *', '');
            query.query = query.query.replace( /\$/g, ':');
            query.query = query.query.replace(" AS ", " ");
            

            // Run Query
            connectionObject.pool.getConnection(
                    function (err, connection)
                    {
                        if (err) {
                            handleQueryError(err, 'destroy');
                            return;
                        }
                        if (LOG_QUERIES) {
                            console.log('Executing query: ' + query.query);
                            console.log('Data for query: ' + JSON.stringify(query.values));
                        }
                        connection.execute(query.query, query.values, {autoCommit: true, outFormat: oracledb.OBJECT}, function __DELETE__(err, result) {
                            if (err) {
                                /* Release the connection back to the connection pool */
                                doRelease(connection);
                                return cb(handleQueryError(err, 'destroy'));
                            }

                            /* Release the connection back to the connection pool */
                            doRelease(connection);

                            cb(null, result.rows);

                        });
                    });

        }
function(connectionName, table, options, cb) {
            if (LOG_DEBUG) {
                console.log("BEGIN destroy");
            }
            
            var connectionObject = connections[connectionName];
            var collection = connectionObject.collections[table];

            var _schema = connectionObject.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.destroy(table, options);
            } catch (e) {
                return cb(e);
            }

            query.query = query.query.replace('RETURNING *', '');
            query.query = query.query.replace( /\$/g, ':');
            query.query = query.query.replace(" AS ", " ");
            

            // Run Query
            connectionObject.pool.getConnection(
                    function (err, connection)
                    {
                        if (err) {
                            handleQueryError(err, 'destroy');
                            return;
                        }
                        if (LOG_QUERIES) {
                            console.log('Executing query: ' + query.query);
                            console.log('Data for query: ' + JSON.stringify(query.values));
                        }
                        connection.execute(query.query, query.values, {autoCommit: true, outFormat: oracledb.OBJECT}, function __DELETE__(err, result) {
                            if (err) {
                                /* Release the connection back to the connection pool */
                                doRelease(connection);
                                return cb(handleQueryError(err, 'destroy'));
                            }

                            /* Release the connection back to the connection pool */
                            doRelease(connection);

                            cb(null, result.rows);

                        });
                    });

        }
function ( connectionName , table , options , cb ) { if ( LOG_DEBUG ) { console . log ( "BEGIN destroy" ) ; } var connectionObject = connections [ connectionName ] ; var collection = connectionObject . collections [ table ] ; var _schema = connectionObject . 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 . destroy ( table , options ) ; } catch ( e ) { return cb ( e ) ; } query . query = query . query . replace ( 'RETURNING *' , '' ) ; query . query = query . query . replace ( / \$ / g , ':' ) ; query . query = query . query . replace ( " AS " , " " ) ; // Run Query connectionObject . pool . getConnection ( function ( err , connection ) { if ( err ) { handleQueryError ( err , 'destroy' ) ; return ; } if ( LOG_QUERIES ) { console . log ( 'Executing query: ' + query . query ) ; console . log ( 'Data for query: ' + JSON . stringify ( query . values ) ) ; } connection . execute ( query . query , query . values , { autoCommit : true , outFormat : oracledb . OBJECT } , function __DELETE__ ( err , result ) { if ( err ) { /* Release the connection back to the connection pool */ doRelease ( connection ) ; return cb ( handleQueryError ( err , 'destroy' ) ) ; } /* Release the connection back to the connection pool */ doRelease ( connection ) ; cb ( null , result . rows ) ; } ) ; } ) ; }
Delete one or more models from the collection - PENDIENTE
Delete one or more models from the collection - PENDIENTE