From 59478e06c25303a790a0840ab2ac30662c4ef781 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 5 Aug 2014 16:46:22 +0200 Subject: c'est la merde.. --- program/lib/Roundcube/rcube_db_pgsql.php | 47 +++++++------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) (limited to 'program/lib/Roundcube/rcube_db_pgsql.php') diff --git a/program/lib/Roundcube/rcube_db_pgsql.php b/program/lib/Roundcube/rcube_db_pgsql.php index d72c9d6b3..a06a37c10 100644 --- a/program/lib/Roundcube/rcube_db_pgsql.php +++ b/program/lib/Roundcube/rcube_db_pgsql.php @@ -28,17 +28,6 @@ class rcube_db_pgsql extends rcube_db { public $db_provider = 'postgres'; - /** - * Driver-specific configuration of database connection - * - * @param array $dsn DSN for DB connections - * @param PDO $dbh Connection handler - */ - protected function conn_configure($dsn, $dbh) - { - $this->query("SET NAMES 'utf8'"); - } - /** * Get last inserted record ID * @@ -64,20 +53,19 @@ class rcube_db_pgsql extends rcube_db /** * Return correct name for a specific database sequence * - * @param string $table Table name + * @param string $sequence Secuence name * * @return string Translated sequence name */ - protected function sequence_name($table) + protected function sequence_name($sequence) { - // Note: we support only one sequence per table - // Note: The sequence name must be _seq - $sequence = $table . '_seq'; - $rcube = rcube::get_instance(); + $rcube = rcube::get_instance(); // return sequence name if configured - if ($prefix = $rcube->config->get('db_prefix')) { - return $prefix . $sequence; + $config_key = 'db_sequence_'.$sequence; + + if ($name = $rcube->config->get($config_key)) { + return $name; } return $sequence; @@ -86,6 +74,9 @@ class rcube_db_pgsql extends rcube_db /** * Return SQL statement to convert a field value into a unix timestamp * + * This method is deprecated and should not be used anymore due to limitations + * of timestamp functions in Mysql (year 2038 problem) + * * @param string $field Field name * * @return string SQL statement to use in query @@ -96,24 +87,6 @@ class rcube_db_pgsql extends rcube_db return "EXTRACT (EPOCH FROM $field)"; } - /** - * Return SQL function for current time and date - * - * @param int $interval Optional interval (in seconds) to add/subtract - * - * @return string SQL function to use in query - */ - public function now($interval = 0) - { - if ($interval) { - $add = ' ' . ($interval > 0 ? '+' : '-') . " interval '"; - $add .= $interval > 0 ? intval($interval) : intval($interval) * -1; - $add .= " seconds'"; - } - - return "now()" . $add; - } - /** * Return SQL statement for case insensitive LIKE * -- cgit v1.2.3