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

Bug #12905 function add
Submitted: 2008-01-14 20:46 UTC
From: bkristl Assigned: quipo
Status: Closed Package: MDB_QueryTool (version 1.2.2)
PHP Version: 5.2.4 OS: suse 10.2
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 : 12 - 1 = ?

 
 [2008-01-14 20:46 UTC] bkristl (Bo¨tjan Kristl)
Description: ------------ when i use add function with MDB2 support and add data without primaryCol(example id), the function don't return id of add object, it's return value null. in the short way: function add return NULL when i save data Test script: --------------- <?php require_once ("MDB/QueryTool.php"); require_once 'MDB/QueryTool.php'; class Car extends MDB_QueryTool{ public $table = 'cars'; function __construct($DSN){ //we use mdb2 parent::__construct($DSN, '', 2); } } $DSNW = 'mysql://dz:dzabalesku@localhost/dz'; $car = new Car($DSNW); //add a new car to the database $data = array( 'model' => 'Super Trooper', 'hp' => 140, 'color' => 'black', 'clima' => 0, 'price' => 19000 ); $newCarId = $car->save($data); var_dump($newCarId); ?> Expected result: ---------------- they must id of inserted object (car)

Comments

 [2008-01-14 20:58 UTC] bkristl (Bo¨tjan Kristl)
function MDB2/Extended.php getBeforeID return NULL if is supported auto_increment. function add (MDB_QueryTool )call getBeforeID in MDB_QueryTool (version 1.2.2), but in version MDB_QueryTool (version 1.2.0) is calling function nextID
 [2008-01-21 14:18 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.