ZF2-208: unable to get last insert id

Issue Type: Bug Created: 2012-03-09T17:12:40.000+0000 Last Updated: 2012-05-11T16:39:24.000+0000 Status: Resolved Fix version(s): Reporter: Fabrizio Balliano (balliano) Assignee: Ralph Schindler (ralph) Tags: - Zend\Db

Related issues: Attachments:


the doc doesn't say a thing about thins but it seems that

$result = $adapter->createStatement("INSERT INTO table (field) VALUES ('test')")->execute(); $result->getResource()->getLastGeneratedId();

throws an error


Posted by Ja De (jade) on 2012-05-06T15:18:45.000+0000

If somebody has to do work on this any way, maybe it is worth considering using a query to LAST_INSERT_ID() on Mysql adapters by default and make use of PHP function "mysql_insert_id" configurable.

This would make "getLastGeneratedId()" BIGINT-tolerant by default.

Posted by Ralph Schindler (ralph) on 2012-05-11T16:39:24.000+0000

Fixed in master, please try this:

<pre class="highlight">

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.