Skip to content

Commit

Permalink
Fix: db_insert_id() did not use mysql_insert_id(), but executed anoth…
Browse files Browse the repository at this point in the history
…er query

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1956 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Jeroen Latour committed Feb 19, 2003
1 parent 26f086a commit 007ab40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/database_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: database_api.php,v 1.16 2003-02-18 00:06:14 jfitzell Exp $
# $Id: database_api.php,v 1.17 2003-02-19 18:06:07 jlatour Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -129,11 +129,12 @@ function db_result( $p_result, $p_index1=0, $p_index2=0 ) {

# --------------------
# return the last inserted id
# For MS SQL use: SELECT @@IDENTITY AS 'id'
function db_insert_id() {
$query = 'SELECT LAST_INSERT_ID()';
$t_result = db_query( $query );
return db_result( $t_result, 0, 0 );
if ( mysql_affected_rows() > 0 ) {
return mysql_insert_id();
} else {
return false;
}
}

# --------------------
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeLog
Expand Up @@ -3,6 +3,7 @@ Mantis ChangeLog
2003.??.?? - 0.18.0a3

* Fix: META redirects were not XHTML-compliant
* Fix: db_insert_id() did not use mysql_insert_id(), but executed another query (which is probably slower)
* Languages: Updated German localisation.

2003.02.19 - 0.18.0a2
Expand Down

0 comments on commit 007ab40

Please sign in to comment.