summaryrefslogtreecommitdiff
path: root/program/include/rcube_db_mysql.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/include/rcube_db_mysql.php')
-rw-r--r--program/include/rcube_db_mysql.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/program/include/rcube_db_mysql.php b/program/include/rcube_db_mysql.php
index 84a324701..71f81956a 100644
--- a/program/include/rcube_db_mysql.php
+++ b/program/include/rcube_db_mysql.php
@@ -90,4 +90,27 @@ class rcube_db_mysql extends rcube_db
return $result;
}
+ /**
+ * Get database runtime variables
+ *
+ * @param string $varname Variable name
+ * @param mixed $default Default value if variable is not set
+ *
+ * @return mixed Variable value or default
+ */
+ public function get_variable($varname, $default = null)
+ {
+ if (!isset($this->variables)) {
+ $this->variables = array();
+
+ $result = $this->query('SHOW VARIABLES');
+
+ while ($sql_arr = $this->fetch_array($result)) {
+ $this->variables[$row[0]] = $row[1];
+ }
+ }
+
+ return isset($this->variables[$varname]) ? $this->variables[$varname] : $default;
+ }
+
}