Fixed table selection query in sanitize_database().
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 24 Oct 2009 09:04:33 +0000 (09:04 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 24 Oct 2009 09:04:33 +0000 (09:04 +0000)
sql/alter2.2.php

index e94187d38e8a7ef2b8ef223950f0ac6ac8bad6c2..c5345233f9dad968a351735b71f50b2df0a31924 100644 (file)
@@ -287,7 +287,7 @@ function sanitize_database($pref, $test = false) {
         if ($test)
                error_log('Sanitizing database ...');
 
-        $tsql = "SHOW TABLES LIKE '{$pref}%'";
+        $tsql = "SHOW TABLES LIKE '".($pref=='' ? '' : substr($pref,0,-1).'\\_')."%'";
         $tresult = db_query($tsql, "Cannot select all tables with prefix '$pref'");
         while($tbl = db_fetch($tresult)) {
                $table = $tbl[0];