diff options
-rw-r--r-- | modules/gallery/libraries/MY_Database.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/gallery/libraries/MY_Database.php b/modules/gallery/libraries/MY_Database.php index 0f29c09b..52bc46d6 100644 --- a/modules/gallery/libraries/MY_Database.php +++ b/modules/gallery/libraries/MY_Database.php @@ -20,6 +20,17 @@ abstract class Database extends Database_Core { protected $_table_names; + /** + * Parse the query string and convert any strings of the form `\([a-zA-Z0-9_]*?)\] + * table prefix . $1 + */ + public function query($sql = '') { + if (!empty($sql)) { + $sql = $this->add_table_prefixes($sql); + } + return parent::query($sql); + } + public function add_table_prefixes($sql) { $prefix = $this->config["table_prefix"]; if (strpos($sql, "SHOW TABLES") === 0) { |