Skip to content

Commit

Permalink
bug #3155842 [core] Edit relational page and page number
Browse files Browse the repository at this point in the history
  • Loading branch information
lem9 committed Jan 12, 2011
1 parent 8244589 commit 31cd4bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -11,6 +11,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- patch #3150164 [structure] Ordering by size gives incorrect results,
thanks to Madhura Jayaratne - madhuracj
- bug #3153409 [core] 0 row(s) affected
- bug #3155842 [core] Edit relational page and page number

3.3.9.0 (2011-01-03)
- bug [doc] Fix references to MySQL doc
Expand Down
4 changes: 1 addition & 3 deletions libraries/dbi/mysql.dbi.lib.php
Expand Up @@ -396,13 +396,11 @@ function PMA_DBI_insert_id($link = null)
return false;
}
}
//$insert_id = mysql_insert_id($link);
// if the primary key is BIGINT we get an incorrect result
// 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);
}

Expand Down
8 changes: 7 additions & 1 deletion libraries/dbi/mysqli.dbi.lib.php
Expand Up @@ -457,7 +457,13 @@ function PMA_DBI_insert_id($link = '')
return false;
}
}
return mysqli_insert_id($link);
// When no controluser is defined, using mysqli_insert_id($link)
// does not always return the last insert id due to a mixup with
// the tracking mechanism, but this works:
return PMA_DBI_fetch_value('SELECT LAST_INSERT_ID();', 0, 0, $link);
// Curiously, this problem does not happen with the mysql extension but
// there is another problem with BIGINT primary keys so PMA_DBI_insert_id()
// in the mysql extension also uses this logic.
}

/**
Expand Down

0 comments on commit 31cd4bd

Please sign in to comment.