mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 01:03:31 +02:00
Feature 1255 :
update pwg_db_insert_id() function. PosgreSQL needs table name to retrieve last insert auto increment id. git-svn-id: http://piwigo.org/svn/trunk@4892 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -192,9 +192,15 @@ function pwg_db_real_escape_string($s)
|
||||
return pg_escape_string($s);
|
||||
}
|
||||
|
||||
function pwg_db_insert_id()
|
||||
function pwg_db_insert_id($table=null, $column='id')
|
||||
{
|
||||
// select currval('piwigo_user_id_seq');
|
||||
$sequence = sprintf('%s_%s_seq', strtolower($table), $column);
|
||||
$query = '
|
||||
SELECT CURRVAL(\''.$sequence.'\');';
|
||||
|
||||
list($id) = pwg_db_fetch_row(pwg_query($query));
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user