Ori.livneh has uploaded a new change for review.

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

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, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/11/247511/1

diff --git a/includes/db/DBConnRef.php b/includes/db/DBConnRef.php
index 4195719..7702c41 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()
+               $table, $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..d04583e 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -1712,14 +1712,15 @@
         * @param array|string $conds Filters on the table
         * @param string $fname Function name for profiling
         * @param array $options Options for select
+        * @param string|array $join_conds Join conditions
         * @return int Row count
         * @since 1.24
         */
        public function selectRowCount(
-               $table, $vars = '*', $conds = '', $fname = __METHOD__, $options 
= array()
+               $table, $vars = '*', $conds = '', $fname = __METHOD__, $options 
= array(), $join_conds = array()
        ) {
                $rows = 0;
-               $sql = $this->selectSQLText( $table, '1', $conds, $fname, 
$options );
+               $sql = $this->selectSQLText( $table, '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..b70f853 100644
--- a/includes/db/IDatabase.php
+++ b/includes/db/IDatabase.php
@@ -704,11 +704,12 @@
         * @param array|string $conds Filters on the table
         * @param string $fname Function name for profiling
         * @param array $options Options for select
+        * @param string|array $join_conds Join conditions
         * @return int Row count
         * @since 1.24
         */
        public function selectRowCount(
-               $table, $vars = '*', $conds = '', $fname = __METHOD__, $options 
= array()
+               $table, $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: newchange
Gerrit-Change-Id: I8c0a93713c121bc5b691ae65d6b6d8f8c08c9e4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

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

Reply via email to