From 68b801e9873c97c564cb6d06f5fe7c7e4e9b1575 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 24 Mar 2004 07:49:50 +0000 Subject: [PATCH] mysql_list_tables() is deprecated; switch to more elegant solution used in REL1_2 branch. --- includes/Database.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/includes/Database.php b/includes/Database.php index fac49592a1..64cfbf11fa 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -332,16 +332,15 @@ class Database { function tableExists( $table ) { - $res = mysql_list_tables( $this->mDBname ); - if( !$res ) { - echo "** " . $this->lastError() . "\n"; + $old = $this->mIgnoreErrors; + $res = $this->query( "SELECT 1 FROM $table LIMIT 1" ); + $this->mIgnoreErrors = $old; + if( $res ) { + $this->freeResult( $res ); + return true; + } else { return false; } - $nTables = $this->numRows( $res ); - for( $i = 0; $i < $nTables; $i++ ) { - if( mysql_tablename( $res, $i ) == $table ) return true; - } - return false; } function fieldInfo( $table, $field ) -- 2.20.1