public function executeAsTransaction($query, $arg_sets, $which_connection='')
    {
        $which_connection = $which_connection === '' ? $this->default_db : $which_connection;
        $ret = true;
        $statement = $this->prepare($query, $which_connection);
        $this->startTransaction($which_connection);
        $this->lockTimeout(5, $which_connection);
        foreach ($arg_sets as $args) {
            if (!$this->execute($statement, $args, $which_connection)) {
                $ret = false;
                break;
            }
        }
        if ($ret === true) {
            $this->commitTransaction($which_connection);
        } else {
            $this->rollbackTransaction($which_connection);
        }

        return $ret;
    }
public function executeAsTransaction($query, $arg_sets, $which_connection='')
    {
        $which_connection = $which_connection === '' ? $this->default_db : $which_connection;
        $ret = true;
        $statement = $this->prepare($query, $which_connection);
        $this->startTransaction($which_connection);
        $this->lockTimeout(5, $which_connection);
        foreach ($arg_sets as $args) {
            if (!$this->execute($statement, $args, $which_connection)) {
                $ret = false;
                break;
            }
        }
        if ($ret === true) {
            $this->commitTransaction($which_connection);
        } else {
            $this->rollbackTransaction($which_connection);
        }

        return $ret;
    }
public function executeAsTransaction ( $ query , $ arg_sets , $ which_connection = '' ) { $ which_connection = $ which_connection === '' ? $ this -> default_db : $ which_connection ; $ ret = true ; $ statement = $ this -> prepare ( $ query , $ which_connection ) ; $ this -> startTransaction ( $ which_connection ) ; $ this -> lockTimeout ( 5 , $ which_connection ) ; foreach ( $ arg_sets as $ args ) { if ( ! $ this -> execute ( $ statement , $ args , $ which_connection ) ) { $ ret = false ; break ; } } if ( $ ret === true ) { $ this -> commitTransaction ( $ which_connection ) ; } else { $ this -> rollbackTransaction ( $ which_connection ) ; } return $ ret ; }
Execute a statement repeatedly as transaction.
Commit if all statements succeed.
Otherwise roll back.
Execute a statement repeatedly as transaction . Commit if all statements succeed . Otherwise roll back .