From 02540767560d7e83703d9cf7cc04283a49d70b20 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Mon, 17 Jul 2006 16:51:51 +0000 Subject: [PATCH] bug #1523623, BIGINT auto_increment and mysql extension --- ChangeLog | 4 ++++ libraries/dbi/mysql.dbi.lib.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b39b9286f..48d06ffeb 100755 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ $Id$ $Source$ +2006-07-17 Marc Delisle + * libraries/dbi/mysql.dbi.lib.php: + bug #1523623, BIGINT auto_increment and mysql extension + 2006-07-16 Marc Delisle * tbl_change.php: Edit next row did not work in 2.9.0-dev diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index c9281f499..d3fb35775 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -319,7 +319,14 @@ function PMA_DBI_insert_id($link = null) return FALSE; } } - return mysql_insert_id($link); + //$insert_id = mysql_insert_id($link); + // if the primary key is BIGINT we get an incorrect result + // (sometimes negative, sometimes positive) + // and in the present function we don't know if the PK is BIGINT + // so better play safe and use LAST_INSERT_ID() + // + // by the way, no problem with mysqli_insert_id() + return PMA_DBI_fetch_value('SELECT LAST_INSERT_ID();', 0, 0, $link); } function PMA_DBI_affected_rows($link = null)