lib/transactions.js
function (callback) {
        var conn = this.connection(),
            id = this._id; // use the raw ID object

        // prevent new transactions from using this connection.
        this.disconnect();

        // if commit was called with no active conn, it implies, no transact action
        // was called. as such it is an error.
        if (!conn) {
            // allow one pseudo commit even without connection, so that programmatic call of repeated commits or
            // rollbacks can be trapped.
            // note that the absence of `_id` indicates that a `.disconnect` was called.
            return callback && callback(id ? null : new AdapterError(AdapterError.TRANSACTION_UNINITIATED_ROLL));
        }

        conn.rollback(function (error) {
            // try releasing the connection.
            // if that fails then treat it as a major error.
            try {
                conn.release();
            }
            // if there was an error during release, set that as the main error.
            catch (err) {
                !error && (error = err);
            }

            // disassociate the connection from transaction and execute callback
            Transaction.disassociateConnection(conn);
            callback && callback(error);
        });
    }
function (callback) {
        var conn = this.connection(),
            id = this._id; // use the raw ID object

        // prevent new transactions from using this connection.
        this.disconnect();

        // if commit was called with no active conn, it implies, no transact action
        // was called. as such it is an error.
        if (!conn) {
            // allow one pseudo commit even without connection, so that programmatic call of repeated commits or
            // rollbacks can be trapped.
            // note that the absence of `_id` indicates that a `.disconnect` was called.
            return callback && callback(id ? null : new AdapterError(AdapterError.TRANSACTION_UNINITIATED_ROLL));
        }

        conn.rollback(function (error) {
            // try releasing the connection.
            // if that fails then treat it as a major error.
            try {
                conn.release();
            }
            // if there was an error during release, set that as the main error.
            catch (err) {
                !error && (error = err);
            }

            // disassociate the connection from transaction and execute callback
            Transaction.disassociateConnection(conn);
            callback && callback(error);
        });
    }
function ( callback ) { var conn = this . connection ( ) , id = this . _id ; // use the raw ID object // prevent new transactions from using this connection. this . disconnect ( ) ; // if commit was called with no active conn, it implies, no transact action // was called. as such it is an error. if ( ! conn ) { // allow one pseudo commit even without connection, so that programmatic call of repeated commits or // rollbacks can be trapped. // note that the absence of `_id` indicates that a `.disconnect` was called. return callback && callback ( id ? null : new AdapterError ( AdapterError . TRANSACTION_UNINITIATED_ROLL ) ) ; } conn . rollback ( function ( error ) { // try releasing the connection. // if that fails then treat it as a major error. try { conn . release ( ) ; } // if there was an error during release, set that as the main error. catch ( err ) { ! error && ( error = err ) ; } // disassociate the connection from transaction and execute callback Transaction . disassociateConnection ( conn ) ; callback && callback ( error ) ; } ) ; }
Rollback the transaction
@param {function} callback - receives `error`
Rollback the transaction