summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_db_mysql.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/program/include/rcube_db_mysql.php b/program/include/rcube_db_mysql.php
index 38b15fa42..3606ec102 100644
--- a/program/include/rcube_db_mysql.php
+++ b/program/include/rcube_db_mysql.php
@@ -59,6 +59,10 @@ class rcube_db_mysql extends rcube_db
/**
* Returns PDO DSN string from DSN array
+ *
+ * @param array $dsn DSN parameters
+ *
+ * @return string Connection string
*/
protected function dsn_string($dsn)
{
@@ -91,6 +95,40 @@ class rcube_db_mysql extends rcube_db
}
/**
+ * Returns driver-specific connection options
+ *
+ * @param array $dsn DSN parameters
+ *
+ * @return array Connection options
+ */
+ protected function dsn_options($dsn)
+ {
+ $result = array();
+
+ if (!empty($dsn['key'])) {
+ $result[PDO::MYSQL_ATTR_KEY] = $dsn['key'];
+ }
+
+ if (!empty($dsn['cipher'])) {
+ $result[PDO::MYSQL_ATTR_CIPHER] = $dsn['cipher'];
+ }
+
+ if (!empty($dsn['cert'])) {
+ $result[PDO::MYSQL_ATTR_SSL_CERT] = $dsn['cert'];
+ }
+
+ if (!empty($dsn['capath'])) {
+ $result[PDO::MYSQL_ATTR_SSL_CAPATH] = $dsn['capath'];
+ }
+
+ if (!empty($dsn['ca'])) {
+ $result[PDO::MYSQL_ATTR_SSL_CA] = $dsn['ca'];
+ }
+
+ return $result;
+ }
+
+ /**
* Get database runtime variables
*
* @param string $varname Variable name