From df8e8ec9eee72743d0f14a8409aacf66c4a80d89 Mon Sep 17 00:00:00 2001 From: yllar <yllar.pajus@gmail.com> Date: Mon, 11 Dec 2006 12:09:34 -0500 Subject: [PATCH] updated da, de_DE, pt_BR, bs_BA, fr, pl, et_EE translations --- program/include/rcube_db.inc | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc index 5b32798..a01b38d 100755 --- a/program/include/rcube_db.inc +++ b/program/include/rcube_db.inc @@ -292,13 +292,14 @@ switch($this->db_provider) { case 'pgsql': - // PostgreSQL uses sequences $result = &$this->db_handle->getOne("SELECT CURRVAL('$sequence')"); + + case 'mssql': + $result = &$this->db_handle->getOne("SELECT @@IDENTITY"); + if (DB::isError($result)) - { raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__, 'message' => $result->getMessage()), TRUE, FALSE); - } return $result; @@ -421,6 +422,25 @@ } + /* + * Return SQL function for current time and date + * + * @return string SQL function to use in query + * @access public + */ + function now() + { + switch($this->db_provider) + { + case 'mssql': + return "getdate()"; + + default: + return "now()"; + } + } + + /** * Return SQL statement to convert a field value into a unix timestamp * @@ -434,7 +454,9 @@ { case 'pgsql': return "EXTRACT (EPOCH FROM $field)"; - break; + + case 'mssql': + return "datediff(s, '1970-01-01 00:00:00', $field)"; default: return "UNIX_TIMESTAMP($field)"; @@ -456,7 +478,7 @@ case 'mysqli': case 'mysql': case 'sqlite': - return "FROM_UNIXTIME($timestamp)"; + return sprintf("FROM_UNIXTIME(%d)", $timestamp); default: return date("'Y-m-d H:i:s'", $timestamp); -- Gitblit v1.9.1