diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-08-04 08:22:41 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-08-04 08:22:41 +0000 |
| commit | 7ea1dc2c56f32f89deb3269ad8f9b35ae90929e1 (patch) | |
| tree | a309f76ff138559871e63c6171002a302b0a9843 /roundcubemail/program/include/rcube_mdb2.php | |
| parent | c801e26c3fb4e366e1c49e69c2b4fe9cd01999c9 (diff) | |
- Use sequence names only with PostgreSQL (#1486018)
git-svn-id: https://svn.roundcube.net/trunk@2834 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_mdb2.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_mdb2.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/roundcubemail/program/include/rcube_mdb2.php b/roundcubemail/program/include/rcube_mdb2.php index 12f3c1652..2fce391d9 100644 --- a/roundcubemail/program/include/rcube_mdb2.php +++ b/roundcubemail/program/include/rcube_mdb2.php @@ -321,16 +321,20 @@ class rcube_mdb2 * Get last inserted record ID * For Postgres databases, a sequence name is required * - * @param string Sequence name for increment + * @param string Table name (to find the incremented sequence) * @return mixed ID or FALSE on failure * @access public */ - function insert_id($sequence = '') + function insert_id($table = '') { if (!$this->db_handle || $this->db_mode=='r') return FALSE; - $id = $this->db_handle->lastInsertID($sequence); + // find sequence name + if ($table && $this->db_provider == 'pgsql') + $table = get_sequence_name($table); + + $id = $this->db_handle->lastInsertID($table); return $this->db_handle->isError($id) ? null : $id; } |
