Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.3

Bug #13388 ->add with mdb2 and mysql v5.0
Submitted: 2008-03-13 15:24 UTC
From: noodle Assigned: quipo
Status: Closed Package: MDB_QueryTool (version 1.2.2)
PHP Version: 5.2.3 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 27 + 21 = ?

 
 [2008-03-13 15:24 UTC] noodle (Emmanuel Drouet)
Description: ------------ I have updated mdb_querytool 1.2.0 to 1.2.2 Since, when i tried to insert new entry in a table containing an autoincremental id, this fail. MDB2 : 2.4.1 MDB_QueryTool : 1.2.2 PHP : 5.2.3 Mysql : 5.0.37 Test script: --------------- CREATE TABLE `artists` ( `id` int(11) unsigned NOT NULL auto_increment, `bar` varchar(250) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; <?php require_once 'MDB/QueryTool.php'; require_once 'MDB2.php'; define('TABLE_FOO', 'foo'); function doErrorHandler($message) { echo '<pre>mdb message : '.print_r($message, true).'</pre>'; } $doOptions = array ( 'autoConnect' => true, 'errorSetCallback' => 'doErrorHandler' ); class doFoo extends MDB_QueryTool { var $table = TABLE_FOO; var $sequenceName = TABLE_FOO; var $primaryCol = 'id'; var $tableSpec = array( array('name' => TABLE_FOO, 'shortName' => 'foo'), ); } $_cDb =& MDB2::connect($cfg['dsn']); if (MDB2::isError($_cDb)) { PEAR::raiseError($_cDb->toString()); die($_cDb->getMessage()); } $doFoo = new doFoo($_cDb, $doOptions, 2); $datas = array ( 'bar' => 'just a test', ); $insertId = $doFoo->add($datas); echo '<pre>'.print_r($insertId, true).'</pre>'; ?> Expected result: ---------------- 1 Actual result: -------------- mdb message : doFoo::MDB2 Error: unknown error-_doQuery: [Error message: Could not execute statement] [Last executed query: INSERT INTO foo (`bar`, `id`) VALUES ('just a test', 'NULL')] [Native code: 1366] [Native message: Incorrect integer value: 'NULL' for column 'id' at row 1] (unknown)

Comments

 [2008-04-05 13:34 UTC] quipo (Lorenzo Alberton)
Can you try the CVS version, please? I get the expected results...
 [2008-04-05 15:26 UTC] noodle (Emmanuel Drouet)
Works fine with mdb_querytool CVS version :) Thanks
 [2008-04-05 16:27 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.