Smalyshev has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316619

Change subject: Allow BatchRowIterator to also set query options.
......................................................................

Allow BatchRowIterator to also set query options.

Change-Id: I15927c5b7f1edcfb40edd3cda9257b40d0276073
---
M includes/utils/BatchRowIterator.php
1 file changed, 16 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/19/316619/1

diff --git a/includes/utils/BatchRowIterator.php 
b/includes/utils/BatchRowIterator.php
index 9fc2431..b006e02 100644
--- a/includes/utils/BatchRowIterator.php
+++ b/includes/utils/BatchRowIterator.php
@@ -78,6 +78,11 @@
        private $key;
 
        /**
+        * @var array Additional query options
+        */
+       protected $options = [];
+
+       /**
         * @param IDatabase $db The database to read from
         * @param string|array $table      The name or names of the table to 
read from
         * @param string|array $primaryKey The name or names of the primary key 
columns
@@ -97,7 +102,7 @@
        }
 
        /**
-        * @param array $condition Query conditions suitable for use with
+        * @param array $conditions Query conditions suitable for use with
         *  IDatabase::select
         */
        public function addConditions( array $conditions ) {
@@ -105,7 +110,15 @@
        }
 
        /**
-        * @param array $condition Query join conditions suitable for use
+        * @param array $options Query options suitable for use with
+        *  IDatabase::select
+        */
+       public function addOptions( array $options ) {
+               $this->options = array_merge( $this->options, $options );
+       }
+
+       /**
+        * @param array $conditions Query join conditions suitable for use
         *  with IDatabase::select
         */
        public function addJoinConditions( array $conditions ) {
@@ -199,7 +212,7 @@
                        [
                                'LIMIT' => $this->batchSize,
                                'ORDER BY' => $this->orderBy,
-                       ],
+                       ] + $this->options,
                        $this->joinConditions
                );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/316619
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15927c5b7f1edcfb40edd3cda9257b40d0276073
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <smalys...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to