Followup r90429:
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Jun 2011 12:09:22 +0000 (12:09 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 20 Jun 2011 12:09:22 +0000 (12:09 +0000)
* Reverted the public -> protected changes from r90429, except for doQuery() after a review of usage:
** resultObject() is used by lots of things in core and extensions.
** makeSelectOptions() is used by SMW, and if that's going to be public, the other two probably should be too, for consistency.
** doQuery() was used by several things, but mostly by mistake. It's been marked private since r21359 which is before almost all of them. I updated the callers to use query().

* Added "protected" to doQuery() declarations in other database classes.

includes/db/Database.php
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseMssql.php
includes/db/DatabaseMysql.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/db/DatabaseSqlite.php

index eec3ddf..00fdcad 100644 (file)
@@ -1044,7 +1044,7 @@ abstract class DatabaseBase implements DatabaseType {
         * @return Array
         * @see DatabaseBase::select()
         */
-       protected function makeSelectOptions( $options ) {
+       function makeSelectOptions( $options ) {
                $preLimitTail = $postLimitTail = '';
                $startOpts = '';
 
@@ -1517,7 +1517,7 @@ abstract class DatabaseBase implements DatabaseType {
         * @param $options array
         * @return string
         */
-       protected function makeInsertOptions( $options ) {
+       function makeInsertOptions( $options ) {
                return implode( ' ', $options );
        }
 
@@ -1602,7 +1602,7 @@ abstract class DatabaseBase implements DatabaseType {
         * @param $options Array: The options passed to DatabaseBase::update
         * @return string
         */
-       protected function makeUpdateOptions( $options ) {
+       function makeUpdateOptions( $options ) {
                if ( !is_array( $options ) ) {
                        $options = array( $options );
                }
@@ -2758,10 +2758,15 @@ abstract class DatabaseBase implements DatabaseType {
        /**
         * Take the result from a query, and wrap it in a ResultWrapper if 
         * necessary. Boolean values are passed through as is, to indicate success 
-        * of write queries or failure. ResultWrapper objects are also passed 
-        * through.
+        * of write queries or failure. 
+        *
+        * Once upon a time, DatabaseBase::query() returned a bare MySQL result 
+        * resource, and it was necessary to call this function to convert it to
+        * a wrapper. Nowadays, raw database objects are never exposed to external
+        * callers, so this is unnecessary in external code. For compatibility with 
+        * old code, ResultWrapper objects are passed through unaltered.
         */
-       protected function resultObject( $result ) {
+       function resultObject( $result ) {
                if ( empty( $result ) ) {
                        return false;
                } elseif ( $result instanceof ResultWrapper ) {
index d94e625..77d8d76 100644 (file)
@@ -453,10 +453,8 @@ class DatabaseIbm_db2 extends DatabaseBase {
         * The DBMS-dependent part of query()
         * @param  $sql String: SQL query.
         * @return object Result object for fetch functions or false on failure
-        * @access private
         */
-       /*private*/
-       public function doQuery( $sql ) {
+       protected function doQuery( $sql ) {
                $this->applySchema();
                
                // Needed to handle any UTF-8 encoding issues in the raw sql
index 077bd36..5cb14fb 100644 (file)
@@ -117,7 +117,7 @@ class DatabaseMssql extends DatabaseBase {
                }
        }
 
-       function doQuery( $sql ) {
+       protected function doQuery( $sql ) {
                wfDebug( "SQL: [$sql]\n" );
                $this->offset = 0;
 
index 2dc3b73..4f46a3f 100644 (file)
@@ -18,7 +18,7 @@ class DatabaseMysql extends DatabaseBase {
                return 'mysql';
        }
 
-       /*private*/ function doQuery( $sql ) {
+       protected function doQuery( $sql ) {
                if( $this->bufferResults() ) {
                        $ret = mysql_query( $sql, $this->mConn );
                } else {
index d140a11..e3a1823 100644 (file)
@@ -302,7 +302,7 @@ class DatabaseOracle extends DatabaseBase {
                return $this->mTrxLevel ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS;
        }
 
-       function doQuery( $sql ) {
+       protected function doQuery( $sql ) {
                wfDebug( "SQL: [$sql]\n" );
                if ( !mb_check_encoding( $sql ) ) {
                        throw new MWException( "SQL encoding is invalid\n$sql" );
index 3b54cce..adc12de 100644 (file)
@@ -246,7 +246,7 @@ class DatabasePostgres extends DatabaseBase {
                }
        }
 
-       function doQuery( $sql ) {
+       protected function doQuery( $sql ) {
                if ( function_exists( 'mb_convert_encoding' ) ) {
                        $sql = mb_convert_encoding( $sql, 'UTF-8' );
                }
index a6bc696..599e80a 100644 (file)
@@ -213,7 +213,7 @@ class DatabaseSqlite extends DatabaseBase {
         *
         * @return ResultWrapper
         */
-       function doQuery( $sql ) {
+       protected function doQuery( $sql ) {
                $res = $this->mConn->query( $sql );
                if ( $res === false ) {
                        return false;