summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/Roundcube/rcube_db.php4
-rw-r--r--program/lib/Roundcube/rcube_db_mssql.php12
-rw-r--r--program/lib/Roundcube/rcube_db_sqlsrv.php12
3 files changed, 27 insertions, 1 deletions
diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php
index 086fd66cb..597fa75f9 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -368,8 +368,10 @@ class rcube_db
*/
protected function _query($query, $offset, $numrows, $params)
{
+ $query = trim($query);
+
// Read or write ?
- $mode = preg_match('/^(select|show)/i', ltrim($query)) ? 'r' : 'w';
+ $mode = preg_match('/^(select|show|set)/i', $query) ? 'r' : 'w';
$this->db_connect($mode);
diff --git a/program/lib/Roundcube/rcube_db_mssql.php b/program/lib/Roundcube/rcube_db_mssql.php
index 71317078c..4c005b0d0 100644
--- a/program/lib/Roundcube/rcube_db_mssql.php
+++ b/program/lib/Roundcube/rcube_db_mssql.php
@@ -46,6 +46,18 @@ class rcube_db_mssql extends rcube_db
}
/**
+ * Driver-specific configuration of database connection
+ *
+ * @param array $dsn DSN for DB connections
+ * @param PDO $dbh Connection handler
+ */
+ protected function conn_configure($dsn, $dbh)
+ {
+ // Set date format in case of non-default language (#1488918)
+ $this->query("SET DATEFORMAT ymd");
+ }
+
+ /**
* Return SQL function for current time and date
*
* @param int $interval Optional interval (in seconds) to add/subtract
diff --git a/program/lib/Roundcube/rcube_db_sqlsrv.php b/program/lib/Roundcube/rcube_db_sqlsrv.php
index 9958dc291..88473e213 100644
--- a/program/lib/Roundcube/rcube_db_sqlsrv.php
+++ b/program/lib/Roundcube/rcube_db_sqlsrv.php
@@ -46,6 +46,18 @@ class rcube_db_sqlsrv extends rcube_db
}
/**
+ * Driver-specific configuration of database connection
+ *
+ * @param array $dsn DSN for DB connections
+ * @param PDO $dbh Connection handler
+ */
+ protected function conn_configure($dsn, $dbh)
+ {
+ // Set date format in case of non-default language (#1488918)
+ $this->query("SET DATEFORMAT ymd");
+ }
+
+ /**
* Return SQL function for current time and date
*
* @param int $interval Optional interval (in seconds) to add/subtract