MDB2 transaction misconfiguration with mysql
| From: | fusillo | Date: | Wed, 05 Sep 2007 23:55:24 +0000 |
| Subject: | MDB2 transaction misconfiguration with mysql | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-27874@lists.php.net to get a copy of this message | ||
I wrote some php code to test the transaction feature of MDB2 classes.
Here is the code:
$dsn=array('phptype'=>'mysql','username'=>'fakeusr','password'=>'fakepwd','database'=>'fakedb','socket'=>'/tmp/mysql.sock');
$mdb2=&MDB2::singleton($dsn,array('use_transactions'=>true));
if (PEAR::isError($mdb2)) die($mdb2->getMessage());
$options = array('wait' => 'WAIT', 'rw' => 'READ WRITE');
$isolation_level='READ COMMITTED';
echo '<pre>';
var_dump($mdb2->supports('transactions'));
echo '</pre>';
if ($mdb2->supports('transactions')==='true')
echo 'transaction able';else
echo 'transaction disable';I get the dump of bool(false) followed by the message 'transaction disable' I tested the some code again changing the cooncection driver to mysqli getting the same negative result The PEAR Packages' versions are:
MDB2 2.4.1 stableMDB2_Driver_mysql 1.4.1 stable MDB2_Driver_mysqli 1.4.1 stable My dbms is mysql, the version is 5.0.19 The fakedb is a mysql database composed of 1 table, here is the result of mysql query mysql> show create table agente; +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table
|+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | agente | CREATE TABLE
agente (
codice int(10) unsigned NOT NULL,
nome varchar(100) NOT NULL,
PRIMARY KEY (codice)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
i test transactional query with mysql client and it seems to be ok here is the query:
mysql> insert into agente values(0,'cazzaniga luca');
Query OK, 1 row affected (0,01 sec)
mysql> select * from agente where nome like '%cazza%';
+--------+----------------+
| codice | nome |+--------+----------------+
| 0 | cazzaniga luca |+--------+----------------+ 1 row in set (0,00 sec) mysql> rollback; Query OK, 0 rows affected (0,02 sec) mysql> select * from agente where nome like '%cazza%'; Empty set (0,01 sec) here is the result of show status engine: show table status from fakedb; +----------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+----------------+----------------------------------------------------------------------------------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |+----------------+--------+---------+------------+-------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+----------------+----------------------------------------------------------------------------------+
| agente | InnoDB | 10 | Compact | 186 | 88 | 16384 | 0 | 0 | 0 | NULL | 2007-09-01 00:04:59 | | | latin1_swedish_ci | NULL | | InnoDB free: 38912 kBWhy the transactions is disabled? The software version is too dated? Any helps will be really appreciated...