dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rdbms: make selectRowCount() use $var argument to exclude NULLs
[lhc/web/wiklou.git]
/
includes
/
libs
/
rdbms
/
database
/
DatabasePostgres.php
diff --git
a/includes/libs/rdbms/database/DatabasePostgres.php
b/includes/libs/rdbms/database/DatabasePostgres.php
index
7b2ef83
..
c945c35
100644
(file)
--- a/
includes/libs/rdbms/database/DatabasePostgres.php
+++ b/
includes/libs/rdbms/database/DatabasePostgres.php
@@
-409,18
+409,24
@@
class DatabasePostgres extends Database {
* Takes same arguments as Database::select()
*
* @param string $table
* Takes same arguments as Database::select()
*
* @param string $table
- * @param string $var
s
+ * @param string $var
* @param string $conds
* @param string $fname
* @param array $options
* @param array $join_conds
* @return int
*/
* @param string $conds
* @param string $fname
* @param array $options
* @param array $join_conds
* @return int
*/
- public function estimateRowCount( $table, $var
s
= '*', $conds = '',
+ public function estimateRowCount( $table, $var = '*', $conds = '',
$fname = __METHOD__, $options = [], $join_conds = []
) {
$fname = __METHOD__, $options = [], $join_conds = []
) {
+ $conds = $this->normalizeConditions( $conds, $fname );
+ $column = $this->extractSingleFieldFromList( $var );
+ if ( is_string( $column ) && !in_array( $column, [ '*', '1' ] ) ) {
+ $conds[] = "$column IS NOT NULL";
+ }
+
$options['EXPLAIN'] = true;
$options['EXPLAIN'] = true;
- $res = $this->select( $table, $var
s
, $conds, $fname, $options, $join_conds );
+ $res = $this->select( $table, $var, $conds, $fname, $options, $join_conds );
$rows = -1;
if ( $res ) {
$row = $this->fetchRow( $res );
$rows = -1;
if ( $res ) {
$row = $this->fetchRow( $res );