Ensure variables in database classes are defined, used and correctly cased
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Mon, 6 Jan 2014 18:23:05 +0000 (19:23 +0100)
committerSiebrand <siebrand@wikimedia.org>
Mon, 6 Jan 2014 18:46:48 +0000 (18:46 +0000)
Change-Id: I12065b2c2bae1c000edac3c92d1db0c03fc40f90

includes/db/Database.php
includes/db/DatabaseMssql.php
includes/db/DatabaseSqlite.php

index 57575ec..24ceb2f 100644 (file)
@@ -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() ) {
index ab23cd0..f15092f 100644 (file)
@@ -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
         */
index 130d650..1ae2c72 100644 (file)
@@ -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 ) {