diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-12-06 19:51:00 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-12-06 19:51:00 -0800 |
commit | 112aafe5137220181dd74afc509fa6cd39573028 (patch) | |
tree | 64c695326917f9e5e06c0734b1cb67f0691f6e99 | |
parent | 8ed47ceaad15bc7ef7ee292f167c8dddf57593f2 (diff) |
Oops, removed the overload for query() before, we need this back so
that we can prefix table names properly.
-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) { |