From c389a85978bc5cf8f0f9d06c58664a35c4746447 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 08 Jul 2012 04:32:13 -0400
Subject: [PATCH] Add get_variable() implementation
---
program/include/rcube_db_mysql.php | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/program/include/rcube_db_mysql.php b/program/include/rcube_db_mysql.php
index 84a3247..71f8195 100644
--- a/program/include/rcube_db_mysql.php
+++ b/program/include/rcube_db_mysql.php
@@ -90,4 +90,27 @@
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;
+ }
+
}
--
Gitblit v1.9.1