jenkins-bot has submitted this change and it was merged.

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, 14 insertions(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/utils/BatchRowIterator.php 
b/includes/utils/BatchRowIterator.php
index 602587c..ef2c14a 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
@@ -102,6 +107,14 @@
         */
        public function addConditions( array $conditions ) {
                $this->conditions = array_merge( $this->conditions, $conditions 
);
+       }
+
+       /**
+        * @param array $options Query options suitable for use with
+        *  IDatabase::select
+        */
+       public function addOptions( array $options ) {
+               $this->options = array_merge( $this->options, $options );
        }
 
        /**
@@ -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: merged
Gerrit-Change-Id: I15927c5b7f1edcfb40edd3cda9257b40d0276073
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: DCausse <dcau...@wikimedia.org>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to