summaryrefslogtreecommitdiff
path: root/program/include/rcube_mdb2.php
diff options
context:
space:
mode:
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;
}