fix minor db bugs, add preliminary unit testing

This commit is contained in:
Sergey Tsalkov
2011-02-21 01:14:36 -05:00
parent db0feccfd4
commit 2e07278d35
3 changed files with 150 additions and 1 deletions

View File

@@ -42,7 +42,6 @@ class DB
public static function useDB() { return call_user_func_array('DB::setDB', func_get_args()); }
public static function setDB($dbName, $limit=0) {
if (DB::$current_db == $dbName) return true;
$db = DB::get();
DB::$old_db = DB::$current_db;
if (! $db->select_db($dbName)) die("unable to set db to $dbName");
@@ -74,6 +73,7 @@ class DB
}
private static function formatTableName($table) {
$table = str_replace('`', '', $table);
if (strpos($table, '.')) {
list($table_db, $table_table) = explode('.', $table, 2);
$table = "`$table_db`.`$table_table`";