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

Bug #17650 lastInsertId can not handle bigint, forces cast to integer
Submitted: 2010-08-03 03:40 UTC
From: alexpw Assigned: quipo
Status: Closed Package: MDB2_Driver_mysql (version 1.5.0b2)
PHP Version: 5.2.9 OS: OSX
Roadmaps: (Not assigned)    
Subscription  


 [2010-08-03 03:40 UTC] alexpw (Alex Walker)
Description: ------------ If the auto_increment of your table is a bigint, MDB2's lastInsertId() will return PHP_INT_MAX, as soon as the the primary key surpasses the capacity of an integer. The following will fix it. function lastInsertID($table = null, $field = null) { // not using mysql_insert_id() due to http://pear.php.net/bugs/bug.php?id=8051 - return $this->queryOne('SELECT LAST_INSERT_ID()', 'integer'); + return $this->queryOne('SELECT LAST_INSERT_ID()'); } // }}}

Comments

 [2010-08-29 15:22 UTC] quipo (Lorenzo Alberton)
-Status: Open +Status: Closed -Assigned To: +Assigned To: quipo
This bug has been fixed in SVN. 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.