From 7ea1dc2c56f32f89deb3269ad8f9b35ae90929e1 Mon Sep 17 00:00:00 2001 From: alec Date: Tue, 4 Aug 2009 08:22:41 +0000 Subject: - Use sequence names only with PostgreSQL (#1486018) git-svn-id: https://svn.roundcube.net/trunk@2834 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/include/rcube_mdb2.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'roundcubemail/program/include/rcube_mdb2.php') 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; } -- cgit v1.2.3