lib/adapter.js
function (connectionName, table, attrName, attrDef, cb) {
            var connectionObject = connections[connectionName];
            if (LOG_DEBUG) {
                console.log("BEGIN addAttribute");
            }
            // Escape Table Name
            table = utils.escapeName(table);

            // Setup a Schema Definition
            var attrs = {};
            attrs[attrName] = attrDef;

            var _schema = utils.buildSchema(attrs);

            // Build Query
            var query = 'ALTER TABLE ' + table + ' ADD COLUMN ' + _schema;

            // Run Query
            connectionObject.pool.getConnection(
                    function (err, connection)
                    {
                        if (err) {
                            handleQueryError(err, 'addAttribute');
                            return;
                        }
                        if (LOG_QUERIES) {
                            console.log('Executing query: ' + query);
                        }
                        connection.execute(query, {}, {outFormat: oracledb.OBJECT}, function __ADD_ATTRIBUTE__(err, result) {
                            /* Release the connection back to the connection pool */
                            doRelease(connection);
                            if (err)
                                return cb(handleQueryError(err, 'addAttribute'));
                            cb(null, result.rows);
                        });
                    });

        }
function (connectionName, table, attrName, attrDef, cb) {
            var connectionObject = connections[connectionName];
            if (LOG_DEBUG) {
                console.log("BEGIN addAttribute");
            }
            // Escape Table Name
            table = utils.escapeName(table);

            // Setup a Schema Definition
            var attrs = {};
            attrs[attrName] = attrDef;

            var _schema = utils.buildSchema(attrs);

            // Build Query
            var query = 'ALTER TABLE ' + table + ' ADD COLUMN ' + _schema;

            // Run Query
            connectionObject.pool.getConnection(
                    function (err, connection)
                    {
                        if (err) {
                            handleQueryError(err, 'addAttribute');
                            return;
                        }
                        if (LOG_QUERIES) {
                            console.log('Executing query: ' + query);
                        }
                        connection.execute(query, {}, {outFormat: oracledb.OBJECT}, function __ADD_ATTRIBUTE__(err, result) {
                            /* Release the connection back to the connection pool */
                            doRelease(connection);
                            if (err)
                                return cb(handleQueryError(err, 'addAttribute'));
                            cb(null, result.rows);
                        });
                    });

        }
function ( connectionName , table , attrName , attrDef , cb ) { var connectionObject = connections [ connectionName ] ; if ( LOG_DEBUG ) { console . log ( "BEGIN addAttribute" ) ; } // Escape Table Name table = utils . escapeName ( table ) ; // Setup a Schema Definition var attrs = { } ; attrs [ attrName ] = attrDef ; var _schema = utils . buildSchema ( attrs ) ; // Build Query var query = 'ALTER TABLE ' + table + ' ADD COLUMN ' + _schema ; // Run Query connectionObject . pool . getConnection ( function ( err , connection ) { if ( err ) { handleQueryError ( err , 'addAttribute' ) ; return ; } if ( LOG_QUERIES ) { console . log ( 'Executing query: ' + query ) ; } connection . execute ( query , { } , { outFormat : oracledb . OBJECT } , function __ADD_ATTRIBUTE__ ( err , result ) { /* Release the connection back to the connection pool */ doRelease ( connection ) ; if ( err ) return cb ( handleQueryError ( err , 'addAttribute' ) ) ; cb ( null , result . rows ) ; } ) ; } ) ; }
Add a column to a table - NO USADO
Add a column to a table - NO USADO