Zend_Db last_insert_id returns a super large number

I have a MySql table whose main key is the 64-bit BigInt

I use Zend_Db (Zend Framework 1.8.4) to insert a new row and then call lastInsertId () to restore the new row identifier, what I get is a super large number such as 18446744072633694008 and this number changes time from time, but it’s always big. the auto increment index is set to 0, and in the database, the record is actually inserted with the correct primary identifier (0, 1, 2 ...), it's just that returning id from lastInsertId () gives a strange number. Is this a known issue for Zend_db that does not deal with a 64-bit number?

environment: Zend Framework 1.8.4 Apache2 on a 32-bit box, Ubuntu OS MySQL5.1 PHP5.2.4 MySQL adapter: mysqli

thanks

+3
source share
2 answers

This seems to be a bug in the OO implementation of the PHP Mysqli adapter. See this note on the PHP website.

For a temporary stop-gap solution, try using an adapter PDO_Mysql Zend_Db.

I am currently creating a problem and working on a solution to see if I can solve this problem in Zend_Db_Adapter_Mysqli. I will keep this answer informed of my successes.

You can follow my progress on the workaround at http://framework.zend.com/issues/browse/ZF-7590

+3
source

Zend_Db ZF 1.0.

PHP PHP, . , , , , , .

Zend_Db , PHP, , , , , PHP, Zend_Db.

, :

$ cd <zf>/tests
$ vi TestConfiguration.php   # enable the MySQL adapter you're using
$ phpunit --verbose --filter testAdapterInsert Zend/Db/AllTests.php

, , , lastInsertId() PHP.

+1

Source: https://habr.com/ru/post/1715128/


All Articles