Skip to content

Commit

Permalink
Oops, removed the overload for query() before, we need this back so
Browse files Browse the repository at this point in the history
that we can prefix table names properly.
  • Loading branch information
bharat committed Dec 7, 2009
1 parent 8ed47ce commit 112aafe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/gallery/libraries/MY_Database.php
Expand Up @@ -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) {
Expand Down

0 comments on commit 112aafe

Please sign in to comment.