public function beginTransaction()
    {
        // transaction starts only if it was not started before
        $r = $this->inTransaction()
            ? false
            : $this->connection->beginTransaction();

        $this->transaction_depth++;

        return $r;
    }
public function beginTransaction()
    {
        // transaction starts only if it was not started before
        $r = $this->inTransaction()
            ? false
            : $this->connection->beginTransaction();

        $this->transaction_depth++;

        return $r;
    }
public function beginTransaction ( ) { // transaction starts only if it was not started before $ r = $ this -> inTransaction ( ) ? false : $ this -> connection -> beginTransaction ( ) ; $ this -> transaction_depth ++ ; return $ r ; }
Starts new transaction.

Database driver supports statements for starting and committing
transactions. Unfortunately most of them don't allow to nest
transactions and commit gradually.
With this method you have some implementation of nested transactions.

When you call it for the first time it will begin transaction. If you
call it more times, it will do nothing but will increase depth counter.
You will need to call commit() for each execution of beginTransactions()
and only the last commit will perform actual commit in database.

So, if you have been working with the database and got un-handled
exception in the middle of your code, everything will be rolled back.

@return mixed Don't rely on any meaningful return
Starts new transaction .