summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube/rcube_db_pgsql.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-04-27 18:31:40 +0200
committerAleksander Machniak <alec@alec.pl>2013-04-27 18:31:40 +0200
commit399db1b647e14947e97a865c09215969f56a7efe (patch)
tree4801fc0482e3e6fe94fd6668dae03b13926b9d17 /program/lib/Roundcube/rcube_db_pgsql.php
parentd7fcd8ce422a24f794d18e2212163690bf3ca753 (diff)
Add db_prefix configuration option in place of db_table_*/db_sequence_* options
Make possible to use db_prefix for schema initialization in Installer (#1489067) Fix updatedb.sh script so it recognizes also table prefix for external DDL files
Diffstat (limited to 'program/lib/Roundcube/rcube_db_pgsql.php')
-rw-r--r--program/lib/Roundcube/rcube_db_pgsql.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/program/lib/Roundcube/rcube_db_pgsql.php b/program/lib/Roundcube/rcube_db_pgsql.php
index cf23c5e48..adfd2207b 100644
--- a/program/lib/Roundcube/rcube_db_pgsql.php
+++ b/program/lib/Roundcube/rcube_db_pgsql.php
@@ -53,19 +53,20 @@ class rcube_db_pgsql extends rcube_db
/**
* Return correct name for a specific database sequence
*
- * @param string $sequence Secuence name
+ * @param string $table Table name
*
* @return string Translated sequence name
*/
- protected function sequence_name($sequence)
+ protected function sequence_name($table)
{
- $rcube = rcube::get_instance();
+ // Note: we support only one sequence per table
+ // Note: The sequence name must be <table_name>_seq
+ $sequence = $table . '_seq';
+ $rcube = rcube::get_instance();
// return sequence name if configured
- $config_key = 'db_sequence_'.$sequence;
-
- if ($name = $rcube->config->get($config_key)) {
- return $name;
+ if ($prefix = $rcube->config->get('db_prefix')) {
+ return $prefix . $sequence;
}
return $sequence;