PMA_DBI_insert_id

This commit is contained in:
Marc Delisle
2004-01-20 20:52:28 +00:00
parent 5398bb666e
commit a69eb2ebbc
6 changed files with 21 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ $Source$
2004-01-20 Marc Delisle <lem9@users.sourceforge.net> 2004-01-20 Marc Delisle <lem9@users.sourceforge.net>
* all concerned scripts: PMA_DBI_num_rows() * all concerned scripts: PMA_DBI_num_rows()
* all concerned scripts: PMA_DBI_free_result() * all concerned scripts: PMA_DBI_free_result()
* all concerned scripts: PMA_DBI_insert_id()
2004-01-19 Marc Delisle <lem9@users.sourceforge.net> 2004-01-19 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php, libraries/dbi/mysql.dbi.lib.php: * libraries/common.lib.php, libraries/dbi/mysql.dbi.lib.php:

View File

@@ -171,7 +171,11 @@ function PMA_DBI_close($link = '') {
function PMA_DBI_get_dblist($link = '') { function PMA_DBI_get_dblist($link = '') {
if (empty($link)) { if (empty($link)) {
$link = $GLOBALS['userlink']; if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return FALSE;
}
} }
$res = PMA_DBI_try_query('SHOW DATABASES;', $link); $res = PMA_DBI_try_query('SHOW DATABASES;', $link);
$dbs_array = array(); $dbs_array = array();
@@ -198,4 +202,15 @@ function PMA_DBI_num_rows($result) {
return mysql_num_rows($result); return mysql_num_rows($result);
} }
function PMA_DBI_insert_id($link) {
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
$link = $GLOBALS['userlink'];
} else {
return FALSE;
}
}
return mysql_insert_id($link);
}
?> ?>

View File

@@ -81,7 +81,7 @@ if ($cfgRelation['pdfwork']) {
if (isset($autolayout)) { if (isset($autolayout)) {
// save the page number // save the page number
$pdf_page_number = mysql_insert_id((isset($dbh)?$dbh:'')); $pdf_page_number = PMA_DBI_insert_id((isset($dbh)?$dbh:''));
// get the tables that have relations, by descending // get the tables that have relations, by descending
// number of links // number of links

View File

@@ -526,7 +526,7 @@ else {
$message = $strDeletedRows . '&nbsp;' . $num_rows; $message = $strDeletedRows . '&nbsp;' . $num_rows;
} else if ($is_insert) { } else if ($is_insert) {
$message = $strInsertedRows . '&nbsp;' . $num_rows; $message = $strInsertedRows . '&nbsp;' . $num_rows;
$insert_id = mysql_insert_id(); $insert_id = PMA_DBI_insert_id();
if ($insert_id != 0) { if ($insert_id != 0) {
$message .= '<br />'.$strInsertedRowId . '&nbsp;' . $insert_id; $message .= '<br />'.$strInsertedRowId . '&nbsp;' . $insert_id;
} }

View File

@@ -92,7 +92,7 @@ global $cfgRelation;
. ' (\'' . implode('\', \'', $value_parts) . '\', \'' . implode('\', \'', $new_value_parts) . '\')'; . ' (\'' . implode('\', \'', $value_parts) . '\', \'' . implode('\', \'', $new_value_parts) . '\')';
$new_table_rs = PMA_query_as_cu($new_table_query); $new_table_rs = PMA_query_as_cu($new_table_query);
$last_id = (@function_exists('mysql_insert_id') ? @mysql_insert_id() : -1); $last_id = (@function_exists('mysql_insert_id') ? @PMA_DBI_insert_id() : -1);
} // end while } // end while
return $last_id; return $last_id;

View File

@@ -219,7 +219,7 @@ foreach($query AS $query_index => $single_query) {
$total_affected_rows += @mysql_affected_rows(); $total_affected_rows += @mysql_affected_rows();
} }
$insert_id = mysql_insert_id(); $insert_id = PMA_DBI_insert_id();
if ($insert_id != 0) { if ($insert_id != 0) {
$last_message .= '<br />'.$strInsertedRowId . '&nbsp;' . $insert_id; $last_message .= '<br />'.$strInsertedRowId . '&nbsp;' . $insert_id;
} }