summaryrefslogtreecommitdiff
path: root/program/include/rcube_mdb2.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-08-04 08:22:41 +0000
committeralecpl <alec@alec.pl>2009-08-04 08:22:41 +0000
commit6b7e8e705a32088a7cb7094eb3204714442cd4e6 (patch)
tree0554e286dfc5c3a895afbc91ac62583d78aaca9f /program/include/rcube_mdb2.php
parentdbfceb4b5c81d6627fe549ae4a0a8ee24ac52093 (diff)
- Use sequence names only with PostgreSQL (#1486018)
Diffstat (limited to 'program/include/rcube_mdb2.php')
-rw-r--r--program/include/rcube_mdb2.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 12f3c1652..2fce391d9 100644
--- a/program/include/rcube_mdb2.php
+++ b/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;
}