rdbms: remove "m" member prefix from various classes
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 16 Feb 2018 19:16:10 +0000 (11:16 -0800)
committerKrinkle <krinklemail@gmail.com>
Sat, 17 Feb 2018 03:58:46 +0000 (03:58 +0000)
Change-Id: Iade8e8f70bb1307b96683d979d7e3650f4107515

includes/libs/rdbms/database/DatabasePostgres.php
includes/libs/rdbms/database/DatabaseSqlite.php
includes/libs/rdbms/database/resultwrapper/MssqlResultWrapper.php
includes/libs/rdbms/encasing/Blob.php
includes/libs/rdbms/encasing/MssqlBlob.php

index c6d5a14..7d34641 100644 (file)
@@ -35,16 +35,16 @@ class DatabasePostgres extends Database {
        protected $port;
 
        /** @var resource */
        protected $port;
 
        /** @var resource */
-       protected $mLastResult = null;
+       protected $lastResultHandle = null;
        /** @var int The number of rows affected as an integer */
        /** @var int The number of rows affected as an integer */
-       protected $mAffectedRows = null;
+       protected $lastAffectedRowCount = null;
 
        /** @var float|string */
        private $numericVersion = null;
        /** @var string Connect string to open a PostgreSQL connection */
        private $connectString;
        /** @var string */
 
        /** @var float|string */
        private $numericVersion = null;
        /** @var string Connect string to open a PostgreSQL connection */
        private $connectString;
        /** @var string */
-       private $mCoreSchema;
+       private $coreSchema;
        /** @var string[] Map of (reserved table name => alternate table name) */
        private $keywordTableMap = [];
 
        /** @var string[] Map of (reserved table name => alternate table name) */
        private $keywordTableMap = [];
 
@@ -218,13 +218,13 @@ class DatabasePostgres extends Database {
                if ( pg_send_query( $conn, $sql ) === false ) {
                        throw new DBUnexpectedError( $this, "Unable to post new query to PostgreSQL\n" );
                }
                if ( pg_send_query( $conn, $sql ) === false ) {
                        throw new DBUnexpectedError( $this, "Unable to post new query to PostgreSQL\n" );
                }
-               $this->mLastResult = pg_get_result( $conn );
-               $this->mAffectedRows = null;
-               if ( pg_result_error( $this->mLastResult ) ) {
+               $this->lastResultHandle = pg_get_result( $conn );
+               $this->lastAffectedRowCount = null;
+               if ( pg_result_error( $this->lastResultHandle ) ) {
                        return false;
                }
 
                        return false;
                }
 
-               return $this->mLastResult;
+               return $this->lastResultHandle;
        }
 
        protected function dumpError() {
        }
 
        protected function dumpError() {
@@ -244,7 +244,7 @@ class DatabasePostgres extends Database {
                ];
                foreach ( $diags as $d ) {
                        $this->queryLogger->debug( sprintf( "PgSQL ERROR(%d): %s\n",
                ];
                foreach ( $diags as $d ) {
                        $this->queryLogger->debug( sprintf( "PgSQL ERROR(%d): %s\n",
-                               $d, pg_result_error_field( $this->mLastResult, $d ) ) );
+                               $d, pg_result_error_field( $this->lastResultHandle, $d ) ) );
                }
        }
 
                }
        }
 
@@ -371,8 +371,8 @@ class DatabasePostgres extends Database {
 
        public function lastError() {
                if ( $this->conn ) {
 
        public function lastError() {
                if ( $this->conn ) {
-                       if ( $this->mLastResult ) {
-                               return pg_result_error( $this->mLastResult );
+                       if ( $this->lastResultHandle ) {
+                               return pg_result_error( $this->lastResultHandle );
                        } else {
                                return pg_last_error();
                        }
                        } else {
                                return pg_last_error();
                        }
@@ -382,23 +382,23 @@ class DatabasePostgres extends Database {
        }
 
        public function lastErrno() {
        }
 
        public function lastErrno() {
-               if ( $this->mLastResult ) {
-                       return pg_result_error_field( $this->mLastResult, PGSQL_DIAG_SQLSTATE );
+               if ( $this->lastResultHandle ) {
+                       return pg_result_error_field( $this->lastResultHandle, PGSQL_DIAG_SQLSTATE );
                } else {
                        return false;
                }
        }
 
        protected function fetchAffectedRowCount() {
                } else {
                        return false;
                }
        }
 
        protected function fetchAffectedRowCount() {
-               if ( !is_null( $this->mAffectedRows ) ) {
+               if ( !is_null( $this->lastAffectedRowCount ) ) {
                        // Forced result for simulated queries
                        // Forced result for simulated queries
-                       return $this->mAffectedRows;
+                       return $this->lastAffectedRowCount;
                }
                }
-               if ( empty( $this->mLastResult ) ) {
+               if ( empty( $this->lastResultHandle ) ) {
                        return 0;
                }
 
                        return 0;
                }
 
-               return pg_affected_rows( $this->mLastResult );
+               return pg_affected_rows( $this->lastResultHandle );
        }
 
        /**
        }
 
        /**
@@ -644,7 +644,7 @@ __INDEXATTR__;
                                        $tempres = (bool)$this->query( $tempsql, $fname, $savepoint );
 
                                        if ( $savepoint ) {
                                        $tempres = (bool)$this->query( $tempsql, $fname, $savepoint );
 
                                        if ( $savepoint ) {
-                                               $bar = pg_result_error( $this->mLastResult );
+                                               $bar = pg_result_error( $this->lastResultHandle );
                                                if ( $bar != false ) {
                                                        $savepoint->rollback();
                                                } else {
                                                if ( $bar != false ) {
                                                        $savepoint->rollback();
                                                } else {
@@ -669,7 +669,7 @@ __INDEXATTR__;
                        $sql .= '(' . $this->makeList( $args ) . ')';
                        $res = (bool)$this->query( $sql, $fname, $savepoint );
                        if ( $savepoint ) {
                        $sql .= '(' . $this->makeList( $args ) . ')';
                        $res = (bool)$this->query( $sql, $fname, $savepoint );
                        if ( $savepoint ) {
-                               $bar = pg_result_error( $this->mLastResult );
+                               $bar = pg_result_error( $this->lastResultHandle );
                                if ( $bar != false ) {
                                        $savepoint->rollback();
                                } else {
                                if ( $bar != false ) {
                                        $savepoint->rollback();
                                } else {
@@ -683,7 +683,7 @@ __INDEXATTR__;
                        $savepoint->commit();
 
                        // Set the affected row count for the whole operation
                        $savepoint->commit();
 
                        // Set the affected row count for the whole operation
-                       $this->mAffectedRows = $numrowsinserted;
+                       $this->lastAffectedRowCount = $numrowsinserted;
 
                        // IGNORE always returns true
                        return true;
 
                        // IGNORE always returns true
                        return true;
@@ -968,7 +968,7 @@ __INDEXATTR__;
                $this->begin( __METHOD__, self::TRANSACTION_INTERNAL );
                if ( $this->schemaExists( $desiredSchema ) ) {
                        if ( in_array( $desiredSchema, $this->getSchemas() ) ) {
                $this->begin( __METHOD__, self::TRANSACTION_INTERNAL );
                if ( $this->schemaExists( $desiredSchema ) ) {
                        if ( in_array( $desiredSchema, $this->getSchemas() ) ) {
-                               $this->mCoreSchema = $desiredSchema;
+                               $this->coreSchema = $desiredSchema;
                                $this->queryLogger->debug(
                                        "Schema \"" . $desiredSchema . "\" already in the search path\n" );
                        } else {
                                $this->queryLogger->debug(
                                        "Schema \"" . $desiredSchema . "\" already in the search path\n" );
                        } else {
@@ -981,15 +981,15 @@ __INDEXATTR__;
                                array_unshift( $search_path,
                                        $this->addIdentifierQuotes( $desiredSchema ) );
                                $this->setSearchPath( $search_path );
                                array_unshift( $search_path,
                                        $this->addIdentifierQuotes( $desiredSchema ) );
                                $this->setSearchPath( $search_path );
-                               $this->mCoreSchema = $desiredSchema;
+                               $this->coreSchema = $desiredSchema;
                                $this->queryLogger->debug(
                                        "Schema \"" . $desiredSchema . "\" added to the search path\n" );
                        }
                } else {
                                $this->queryLogger->debug(
                                        "Schema \"" . $desiredSchema . "\" added to the search path\n" );
                        }
                } else {
-                       $this->mCoreSchema = $this->getCurrentSchema();
+                       $this->coreSchema = $this->getCurrentSchema();
                        $this->queryLogger->debug(
                                "Schema \"" . $desiredSchema . "\" not found, using current \"" .
                        $this->queryLogger->debug(
                                "Schema \"" . $desiredSchema . "\" not found, using current \"" .
-                               $this->mCoreSchema . "\"\n" );
+                               $this->coreSchema . "\"\n" );
                }
                /* Commit SET otherwise it will be rollbacked on error or IGNORE SELECT */
                $this->commit( __METHOD__, self::FLUSHING_INTERNAL );
                }
                /* Commit SET otherwise it will be rollbacked on error or IGNORE SELECT */
                $this->commit( __METHOD__, self::FLUSHING_INTERNAL );
@@ -1002,7 +1002,7 @@ __INDEXATTR__;
         * @return string Core schema name
         */
        public function getCoreSchema() {
         * @return string Core schema name
         */
        public function getCoreSchema() {
-               return $this->mCoreSchema;
+               return $this->coreSchema;
        }
 
        public function getServerVersion() {
        }
 
        public function getServerVersion() {
index 458d308..58b6ef9 100644 (file)
@@ -46,9 +46,9 @@ class DatabaseSqlite extends Database {
        protected $trxMode;
 
        /** @var int The number of rows affected as an integer */
        protected $trxMode;
 
        /** @var int The number of rows affected as an integer */
-       protected $mAffectedRows;
+       protected $lastAffectedRowCount;
        /** @var resource */
        /** @var resource */
-       protected $mLastResult;
+       protected $lastResultHandle;
 
        /** @var PDO */
        protected $conn;
 
        /** @var PDO */
        protected $conn;
@@ -317,7 +317,7 @@ class DatabaseSqlite extends Database {
                }
 
                $r = $res instanceof ResultWrapper ? $res->result : $res;
                }
 
                $r = $res instanceof ResultWrapper ? $res->result : $res;
-               $this->mAffectedRows = $r->rowCount();
+               $this->lastAffectedRowCount = $r->rowCount();
                $res = new ResultWrapper( $this, $r->fetchAll() );
 
                return $res;
                $res = new ResultWrapper( $this, $r->fetchAll() );
 
                return $res;
@@ -497,7 +497,7 @@ class DatabaseSqlite extends Database {
         * @return int
         */
        protected function fetchAffectedRowCount() {
         * @return int
         */
        protected function fetchAffectedRowCount() {
-               return $this->mAffectedRows;
+               return $this->lastAffectedRowCount;
        }
 
        /**
        }
 
        /**
index 4b79044..ba79be1 100644 (file)
@@ -6,7 +6,7 @@ use stdClass;
 
 class MssqlResultWrapper extends ResultWrapper {
        /** @var int|null */
 
 class MssqlResultWrapper extends ResultWrapper {
        /** @var int|null */
-       private $mSeekTo = null;
+       private $seekTo = null;
 
        /**
         * @return stdClass|bool
 
        /**
         * @return stdClass|bool
@@ -14,10 +14,10 @@ class MssqlResultWrapper extends ResultWrapper {
        public function fetchObject() {
                $res = $this->result;
 
        public function fetchObject() {
                $res = $this->result;
 
-               if ( $this->mSeekTo !== null ) {
+               if ( $this->seekTo !== null ) {
                        $result = sqlsrv_fetch_object( $res, stdClass::class, [],
                        $result = sqlsrv_fetch_object( $res, stdClass::class, [],
-                               SQLSRV_SCROLL_ABSOLUTE, $this->mSeekTo );
-                       $this->mSeekTo = null;
+                               SQLSRV_SCROLL_ABSOLUTE, $this->seekTo );
+                       $this->seekTo = null;
                } else {
                        $result = sqlsrv_fetch_object( $res );
                }
                } else {
                        $result = sqlsrv_fetch_object( $res );
                }
@@ -36,10 +36,10 @@ class MssqlResultWrapper extends ResultWrapper {
        public function fetchRow() {
                $res = $this->result;
 
        public function fetchRow() {
                $res = $this->result;
 
-               if ( $this->mSeekTo !== null ) {
+               if ( $this->seekTo !== null ) {
                        $result = sqlsrv_fetch_array( $res, SQLSRV_FETCH_BOTH,
                        $result = sqlsrv_fetch_array( $res, SQLSRV_FETCH_BOTH,
-                               SQLSRV_SCROLL_ABSOLUTE, $this->mSeekTo );
-                       $this->mSeekTo = null;
+                               SQLSRV_SCROLL_ABSOLUTE, $this->seekTo );
+                       $this->seekTo = null;
                } else {
                        $result = sqlsrv_fetch_array( $res );
                }
                } else {
                        $result = sqlsrv_fetch_array( $res );
                }
@@ -70,7 +70,7 @@ class MssqlResultWrapper extends ResultWrapper {
                }
 
                // Unlike MySQL, the seek actually happens on the next access
                }
 
                // Unlike MySQL, the seek actually happens on the next access
-               $this->mSeekTo = $row;
+               $this->seekTo = $row;
                return true;
        }
 }
                return true;
        }
 }
index e2d685c..7bc3eac 100644 (file)
@@ -4,17 +4,17 @@ namespace Wikimedia\Rdbms;
 
 class Blob implements IBlob {
        /** @var string */
 
 class Blob implements IBlob {
        /** @var string */
-       protected $mData;
+       protected $data;
 
        /**
         * @param string $data
         */
        public function __construct( $data ) {
 
        /**
         * @param string $data
         */
        public function __construct( $data ) {
-               $this->mData = $data;
+               $this->data = $data;
        }
 
        public function fetch() {
        }
 
        public function fetch() {
-               return $this->mData;
+               return $this->data;
        }
 }
 
        }
 }
 
index aacdf40..8e68aba 100644 (file)
@@ -12,11 +12,11 @@ class MssqlBlob extends Blob {
                if ( $data instanceof MssqlBlob ) {
                        return $data;
                } elseif ( $data instanceof Blob ) {
                if ( $data instanceof MssqlBlob ) {
                        return $data;
                } elseif ( $data instanceof Blob ) {
-                       $this->mData = $data->fetch();
+                       $this->data = $data->fetch();
                } elseif ( is_array( $data ) && is_object( $data ) ) {
                } elseif ( is_array( $data ) && is_object( $data ) ) {
-                       $this->mData = serialize( $data );
+                       $this->data = serialize( $data );
                } else {
                } else {
-                       $this->mData = $data;
+                       $this->data = $data;
                }
        }
 
                }
        }
 
@@ -26,14 +26,14 @@ class MssqlBlob extends Blob {
         * @return string
         */
        public function fetch() {
         * @return string
         */
        public function fetch() {
-               if ( $this->mData === null ) {
+               if ( $this->data === null ) {
                        return 'null';
                }
 
                $ret = '0x';
                        return 'null';
                }
 
                $ret = '0x';
-               $dataLength = strlen( $this->mData );
+               $dataLength = strlen( $this->data );
                for ( $i = 0; $i < $dataLength; $i++ ) {
                for ( $i = 0; $i < $dataLength; $i++ ) {
-                       $ret .= bin2hex( pack( 'C', ord( $this->mData[$i] ) ) );
+                       $ret .= bin2hex( pack( 'C', ord( $this->data[$i] ) ) );
                }
 
                return $ret;
                }
 
                return $ret;