summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries/MY_Database.php
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2010-02-10 20:57:53 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2010-02-10 20:57:53 +0000
commit10e36fcf1b5acf07c5cc128105af03fb09aac89e (patch)
treec5e815b0a4c540d0dc7bc5f90dd1eae3df31017e /modules/gallery/libraries/MY_Database.php
parent052476ef44ca801766cbd6bdbfe42d5a0a362e52 (diff)
parent8ef08d20883d9b9aa0b7560ce3bf6da8a6632149 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/libraries/MY_Database.php')
-rw-r--r--modules/gallery/libraries/MY_Database.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/gallery/libraries/MY_Database.php b/modules/gallery/libraries/MY_Database.php
index e2ef68cd..cb70104a 100644
--- a/modules/gallery/libraries/MY_Database.php
+++ b/modules/gallery/libraries/MY_Database.php
@@ -54,11 +54,18 @@ abstract class Database extends Database_Core {
*/
return $sql;
} else if (strpos($sql, "CREATE TABLE") === 0) {
- // Creating a new table add it to the table cache.
+ // Creating a new table; add it to the table cache.
$open_brace = strpos($sql, "{") + 1;
$close_brace = strpos($sql, "}", $open_brace);
$name = substr($sql, $open_brace, $close_brace - $open_brace);
$this->_table_names["{{$name}}"] = "{$prefix}$name";
+ } else if (strpos($sql, "RENAME TABLE") === 0) {
+ // Renaming a table; add it to the table cache.
+ // You must use the form "TO {new_table_name}" exactly for this to work.
+ $open_brace = strpos($sql, "TO {") + 4;
+ $close_brace = strpos($sql, "}", $open_brace);
+ $name = substr($sql, $open_brace, $close_brace - $open_brace);
+ $this->_table_names["{{$name}}"] = "{$prefix}$name";
}
if (!isset($this->_table_names)) {