From: Chad Horohoe Date: Sat, 15 Aug 2009 19:17:56 +0000 (+0000) Subject: Spacing and declare public. X-Git-Tag: 1.31.0-rc.0~40289 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=c8cfe97d4e3b7df2692ab7bb70290b71b5148a44;p=lhc%2Fweb%2Fwiklou.git Spacing and declare public. --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 9ccb00afff..26216039de 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -941,27 +941,24 @@ abstract class DatabaseBase { * Returns estimated count, based on EXPLAIN output * Takes same arguments as Database::select() */ - - function estimateRowCount( $table, $vars='*', $conds='', $fname = 'Database::estimateRowCount', $options = array() ) { - $options['EXPLAIN']=true; - $res = $this->select ($table, $vars, $conds, $fname, $options ); + public function estimateRowCount( $table, $vars='*', $conds='', $fname = 'Database::estimateRowCount', $options = array() ) { + $options['EXPLAIN'] = true; + $res = $this->select( $table, $vars, $conds, $fname, $options ); if ( $res === false ) return false; - if (!$this->numRows($res)) { + if ( !$this->numRows( $res ) ) { $this->freeResult($res); return 0; } - - $rows=1; - + + $rows = 1; while( $plan = $this->fetchObject( $res ) ) { - $rows *= ($plan->rows > 0)?$plan->rows:1; // avoid resetting to zero + $rows *= $plan->rows > 0 ? $plan->rows : 1; // avoid resetting to zero } - + $this->freeResult($res); return $rows; } - /** * Removes most variables from an SQL query and replaces them with X or N for numbers.