Bug #17650 [Opn->Csd]: lastInsertId can not handle bigint, forces cast to integer
| From: | l dot alberton at quipo dot it | Date: | Sun, 29 Aug 2010 11:22:22 +0000 |
| Subject: | Bug #17650 [Opn->Csd]: lastInsertId can not handle bigint, forces cast to integer | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-4711@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=17650&edit=1
ID: 17650
Updated by: l.alberton@quipo.it
Reported By: alex dot walker at announcemedia dot com
Summary: lastInsertId can not handle bigint, forces cast to
integer
-Status: Open
+Status: Closed
Type: Bug
Package: MDB2_Driver_mysql
Operating System: OSX
Package Version: 1.5.0b2
PHP Version: 5.2.9
-Assigned To:
+Assigned To: quipo
Roadmap Versions:
New Comment:
-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.
Previous Comments:
------------------------------------------------------------------------
[2010-08-02 23:40:36] alexpw
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()');
}
// }}}
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=17650&edit=1