From 850d17211bb4c76fa6e910176471bea0c90b4cf7 Mon Sep 17 00:00:00 2001 From: freakolowsky Date: Sun, 26 May 2013 16:49:28 +0200 Subject: [PATCH] Changed tableName so it returns uppercased table names (+prefix) Changed tableExists so it returns boolean (and closes resource when it's done in case it fails) Change-Id: I4f842a634900756618bb4b3b6d83f86492e73fab --- includes/db/DatabaseOracle.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 4fa2397c2c..a4dc662a24 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -686,7 +686,7 @@ class DatabaseOracle extends DatabaseBase { break; } - return parent::tableName( strtoupper( $name ), $format ); + return strtoupper( parent::tableName( $name, $format ) ); } function tableNameInternal( $name ) { @@ -875,7 +875,7 @@ class DatabaseOracle extends DatabaseBase { /** * Query whether a given table exists (in the given schema, or the default mw one if not given) - * @return int + * @return bool */ function tableExists( $table, $fname = __METHOD__ ) { $table = $this->tableName( $table ); @@ -883,13 +883,14 @@ class DatabaseOracle extends DatabaseBase { $owner = $this->addQuotes( strtoupper( $this->mDBname ) ); $SQL = "SELECT 1 FROM all_tables WHERE owner=$owner AND table_name=$table"; $res = $this->doQuery( $SQL ); - if ( $res ) { - $count = $res->numRows(); - $res->free(); + if ( $res && $res->numRows() > 0 ) { + $exists = true; } else { - $count = 0; + $exists = false; } - return $count; + + $res->free(); + return $exists; } /** -- 2.20.1