public function transaction_start($test_only = false) {

        $sql = 'START TRANSACTION';

        // if a transaction is not in progress
        if ($this->transaction_status === 0) {

            // set flag so that the query method will know that a transaction is in progress
            $this->transaction_status = ($test_only ? 3 : 1);

            // try to start transaction
            $this->query($sql);

            // return TRUE if query was successful, or FALSE if it wasn't
            return isset($this->last_result) && $this->last_result !== false;

        }

        // save debug information
        return $this->_log('unsuccessful-queries', array(

            'query' => $sql,
            'error' => $this->language['transaction_in_progress'],

        ), false);

    }
public function transaction_start($test_only = false) {

        $sql = 'START TRANSACTION';

        // if a transaction is not in progress
        if ($this->transaction_status === 0) {

            // set flag so that the query method will know that a transaction is in progress
            $this->transaction_status = ($test_only ? 3 : 1);

            // try to start transaction
            $this->query($sql);

            // return TRUE if query was successful, or FALSE if it wasn't
            return isset($this->last_result) && $this->last_result !== false;

        }

        // save debug information
        return $this->_log('unsuccessful-queries', array(

            'query' => $sql,
            'error' => $this->language['transaction_in_progress'],

        ), false);

    }
public function transaction_start ( $ test_only = false ) { $ sql = 'START TRANSACTION' ; // if a transaction is not in progress if ( $ this -> transaction_status === 0 ) { // set flag so that the query method will know that a transaction is in progress $ this -> transaction_status = ( $ test_only ? 3 : 1 ) ; // try to start transaction $ this -> query ( $ sql ) ; // return TRUE if query was successful, or FALSE if it wasn't return isset ( $ this -> last_result ) && $ this -> last_result !== false ; } // save debug information return $ this -> _log ( 'unsuccessful-queries' , array ( 'query' => $ sql , 'error' => $ this -> language [ 'transaction_in_progress' ] , ) , false ) ; }
Starts the transaction system.

Transactions work only with databases that support transaction-safe table types. In MySQL, these are InnoDB or
BDB table types. Working with MyISAM tables will not raise any errors but statements will be executed
automatically as soon as they are called (just like if there was no transaction).

If you are not familiar with transactions, have a look at {@link http://dev.mysql.com/doc/refman/5.0/en/commit.html here}
and try to find a good online resource for more specific information.

<code>
// start transactions
$db->transaction_start();

// run queries

// if all the queries since "transaction_start" are valid, write data to database;
// if any of the queries had an error, ignore all queries and treat them as if they never happened
$db->transaction_complete();
</code>

@param  boolean     $test_only      (Optional) Starts the transaction system in "test mode" causing the queries
to be rolled back (when {@link transaction_complete()} is called) - even if
all queries are valid.

Default is FALSE.

@since  2.1

@return boolean                     Returns TRUE on success or FALSE on error.
Starts the transaction system .