rdbms: cleanup visibility of Database::makeSelectOptions()
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 4 Sep 2019 03:05:49 +0000 (20:05 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 4 Sep 2019 03:27:27 +0000 (20:27 -0700)
Change-Id: I2e18dd3d450ceec9895d3143074743bc206a943d

includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabasePostgres.php
includes/libs/rdbms/database/DatabaseSqlite.php

index 6aa3f6f..be41ee0 100644 (file)
@@ -1681,12 +1681,13 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
         * Returns an optional USE INDEX clause to go after the table, and a
         * string to go at the end of the query.
         *
+        * @see Database::select()
+        *
         * @param array $options Associative array of options to be turned into
         *   an SQL query, valid keys are listed in the function.
         * @return array
-        * @see Database::select()
         */
-       protected function makeSelectOptions( $options ) {
+       protected function makeSelectOptions( array $options ) {
                $preLimitTail = $postLimitTail = '';
                $startOpts = '';
 
index a7ebc86..c075a1b 100644 (file)
@@ -1301,7 +1301,7 @@ SQL;
                return "'" . pg_escape_string( $conn, (string)$s ) . "'";
        }
 
-       public function makeSelectOptions( $options ) {
+       protected function makeSelectOptions( array $options ) {
                $preLimitTail = $postLimitTail = '';
                $startOpts = $useIndex = $ignoreIndex = '';
 
index 657d308..0e2dc8f 100644 (file)
@@ -603,15 +603,10 @@ class DatabaseSqlite extends Database {
                return in_array( 'UNIQUE', $options );
        }
 
-       /**
-        * Filter the options used in SELECT statements
-        *
-        * @param array $options
-        * @return array
-        */
-       function makeSelectOptions( $options ) {
+       protected function makeSelectOptions( array $options ) {
+               // Remove problematic options that the base implementation converts to SQL
                foreach ( $options as $k => $v ) {
-                       if ( is_numeric( $k ) && ( $v == 'FOR UPDATE' || $v == 'LOCK IN SHARE MODE' ) ) {
+                       if ( is_numeric( $k ) && ( $v === 'FOR UPDATE' || $v === 'LOCK IN SHARE MODE' ) ) {
                                $options[$k] = '';
                        }
                }