diff options
author | alecpl <alec@alec.pl> | 2010-02-03 11:16:18 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-02-03 11:16:18 +0000 |
commit | e1ac217397bfc23a5c059aaa12bba8c1fc018cbb (patch) | |
tree | eb5e2aa2a7e68dddd25aed69fe4ad682006d2e3e /program | |
parent | 359a95e062952f086d5e8a771f6446cd0c1a2056 (diff) |
- Fix inconsistency when not using default table names (#1486467)
Diffstat (limited to 'program')
-rw-r--r-- | program/include/main.inc | 2 | ||||
-rw-r--r-- | program/include/rcube_mdb2.php | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 31e4ab558..944cdf708 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -69,7 +69,7 @@ function get_table_name($table) */ function get_sequence_name($sequence) { - // return table name if configured + // return sequence name if configured $config_key = 'db_sequence_'.$sequence; $opt = rcmail::get_instance()->config->get($config_key); diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php index e8dd7e0a7..aca44c963 100644 --- a/program/include/rcube_mdb2.php +++ b/program/include/rcube_mdb2.php @@ -331,10 +331,15 @@ class rcube_mdb2 if (!$this->db_handle || $this->db_mode=='r') return FALSE; - // find sequence name - if ($table && $this->db_provider == 'pgsql') - $table = get_sequence_name($table); - + if ($table) { + if ($this->db_provider == 'pgsql') + // find sequence name + $table = get_sequence_name($table); + else + // resolve table name + $table = get_table_name($table); + } + $id = $this->db_handle->lastInsertID($table); return $this->db_handle->isError($id) ? null : $id; |