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

Change subject: Database::selectRowCount(): support $join_conds
......................................................................


Database::selectRowCount(): support $join_conds

Add a $join_conds parameter for Database::selectRowCount(), to allow the caller
to specify join conditions for the subquery that it generates.

Change-Id: I8c0a93713c121bc5b691ae65d6b6d8f8c08c9e4c
---
M includes/db/DBConnRef.php
M includes/db/Database.php
M includes/db/IDatabase.php
3 files changed, 12 insertions(+), 8 deletions(-)

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



diff --git a/includes/db/DBConnRef.php b/includes/db/DBConnRef.php
index 4195719..5a8fe92 100644
--- a/includes/db/DBConnRef.php
+++ b/includes/db/DBConnRef.php
@@ -243,7 +243,7 @@
        }
 
        public function selectRowCount(
-               $table, $vars = '*', $conds = '', $fname = __METHOD__, $options 
= array()
+               $tables, $vars = '*', $conds = '', $fname = __METHOD__, 
$options = array(), $join_conds = array()
        ) {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
diff --git a/includes/db/Database.php b/includes/db/Database.php
index 811a4a7..1da85d7 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -1707,19 +1707,21 @@
         *
         * Takes the same arguments as DatabaseBase::select().
         *
-        * @param string $table Table name
+        * @since 1.27 Added $join_conds parameter
+        *
+        * @param array|string $tables Table names
         * @param string $vars Unused
         * @param array|string $conds Filters on the table
         * @param string $fname Function name for profiling
         * @param array $options Options for select
+        * @param array $join_conds Join conditions (since 1.27)
         * @return int Row count
-        * @since 1.24
         */
        public function selectRowCount(
-               $table, $vars = '*', $conds = '', $fname = __METHOD__, $options 
= array()
+               $tables, $vars = '*', $conds = '', $fname = __METHOD__, 
$options = array(), $join_conds = array()
        ) {
                $rows = 0;
-               $sql = $this->selectSQLText( $table, '1', $conds, $fname, 
$options );
+               $sql = $this->selectSQLText( $tables, '1', $conds, $fname, 
$options, $join_conds );
                $res = $this->query( "SELECT COUNT(*) AS rowcount FROM ($sql) 
tmp_count", $fname );
 
                if ( $res ) {
diff --git a/includes/db/IDatabase.php b/includes/db/IDatabase.php
index 51c4bfe..ba3c1dd 100644
--- a/includes/db/IDatabase.php
+++ b/includes/db/IDatabase.php
@@ -699,16 +699,18 @@
         *
         * Takes the same arguments as IDatabase::select().
         *
-        * @param string $table Table name
+        * @since 1.27 Added $join_conds parameter
+        *
+        * @param array|string $tables Table names
         * @param string $vars Unused
         * @param array|string $conds Filters on the table
         * @param string $fname Function name for profiling
         * @param array $options Options for select
+        * @param array $join_conds Join conditions (since 1.27)
         * @return int Row count
-        * @since 1.24
         */
        public function selectRowCount(
-               $table, $vars = '*', $conds = '', $fname = __METHOD__, $options 
= array()
+               $tables, $vars = '*', $conds = '', $fname = __METHOD__, 
$options = array(), $join_conds = array()
        );
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8c0a93713c121bc5b691ae65d6b6d8f8c08c9e4c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to