Re: Transactions in mdb2

From: Date: Wed, 22 Mar 2006 17:13:23 +0000
Subject: Re: Transactions in mdb2
References: 1 2 3 4 5 6 7 8  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23395@lists.php.net to get a copy of this message
Lukas Smith scrisse in data 03/22/06 18:01:
Paolo Sala wrote:
Yes, I've forgotten to insert a queryAll. I rewrite the code:
    $options['use_transactions'] = true;
    $options['default_table_type'] = 'InnoDB';
                $mdb2=& MDB2::connect($dsn, $options);
        if ($mdb2->supports('transactions'))
        $mdb2->beginTransaction();
        $strSQL= 'INSERT INTO [...cut...]';
    $mdb2->queryAll($strSQL);
        if ($mdb2->in_transaction)
        $mdb2->rollback();
and the result is a commit even if I have called a rollback. Furthermore the property in_transaction is true: is the rollback function that doesn't works!
well you still need to make sure that the table you are operating on is a transaction enabled table handler ..
...I hope you forgive my newbeness questions: how can I know if the table is "transaction enabled"? If it is not, there is a way to do it transaction enabled? Perhaps it depends from mysql installation?
the default_table_handler option for example simply means that MDB2 will create all tables with this table handler by default. MDB2 also determines based on this setting if you are using transactional table handlers or not ..
I've found so poor documentation about mdb2... Piviul

« previous php.pear.general (#23395) next »