From 559cc681d394a16ce1af364ad60132f6d84b2ea2 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 6 Jan 2014 19:23:05 +0100 Subject: [PATCH] Ensure variables in database classes are defined, used and correctly cased Change-Id: I12065b2c2bae1c000edac3c92d1db0c03fc40f90 --- includes/db/Database.php | 2 ++ includes/db/DatabaseMssql.php | 17 ++++++++++++++--- includes/db/DatabaseSqlite.php | 2 ++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 57575ec881..24ceb2fc59 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1025,6 +1025,8 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { Profiler::instance()->transactionWritingIn( $this->mServer, $this->mDBname ); } + $queryProf = ''; + $totalProf = ''; $isMaster = !is_null( $this->getLBInfo( 'master' ) ); if ( !Profiler::instance()->isStub() ) { diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index ab23cd0176..f15092f7ba 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -166,7 +166,6 @@ class DatabaseMssql extends DatabaseBase { */ protected function doQuery( $sql ) { wfDebug( "SQL: [$sql]\n" ); - $this->offset = 0; // several extensions seem to think that all databases support limits // via LIMIT N after the WHERE clause well, MSSQL uses SELECT TOP N, @@ -1105,11 +1104,11 @@ class DatabaseMssql extends DatabaseBase { * @ingroup Database */ class MssqlField implements Field { - private $name, $tablename, $default, $max_length, $nullable, $type; + private $name, $tableName, $default, $max_length, $nullable, $type; function __construct( $info ) { $this->name = $info['COLUMN_NAME']; - $this->tablename = $info['TABLE_NAME']; + $this->tableName = $info['TABLE_NAME']; $this->default = $info['COLUMN_DEFAULT']; $this->max_length = $info['CHARACTER_MAXIMUM_LENGTH']; $this->nullable = !( strtolower( $info['IS_NULLABLE'] ) == 'no' ); @@ -1149,6 +1148,18 @@ class MssqlField implements Field { * @ingroup Database */ class MssqlResult { + /** @var int */ + private $mCursor; + + /** @var array */ + private $mRows; + + /** @var bool|int */ + private $mNumFields; + + /** @var array|bool */ + private $mFieldMeta; + /** * @param bool|resource $queryresult */ diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 130d650426..1ae2c72b07 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -124,6 +124,8 @@ class DatabaseSqlite extends DatabaseBase { * @return PDO|bool SQL connection or false if failed */ function openFile( $fileName ) { + $err = false; + $this->mDatabaseFile = $fileName; try { if ( $this->mFlags & DBO_PERSISTENT ) { -- 2.20.1