r10415 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10414‎ | r10415 | r10416 >
Date:10:30, 9 August 2005
Author:hashar
Status:old
Tags:
Comment:
limitResult() use 3 argument since ORACLE merge
Modified paths:
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/DatabasePostgreSQL.php (modified) (history)
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/includes/SearchMySQL.php (modified) (history)
  • /trunk/phase3/includes/SpecialLog.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialLog.php
@@ -154,7 +154,7 @@
155155 $sql .= " WHERE " . implode( ' AND ', $this->whereClauses );
156156 }
157157 $sql .= " ORDER BY log_timestamp DESC ";
158 - $sql = $this->db->limitResult( $sql, $this->limit, $this->offset );
 158+ $sql = $this->db->limitResult($sql, $this->limit, $this->offset );
159159 return $sql;
160160 }
161161
Index: trunk/phase3/includes/DatabasePostgreSQL.php
@@ -372,8 +372,8 @@
373373 return '';
374374 }
375375
376 - function limitResult($limit,$offset) {
377 - return " LIMIT $limit ".(is_numeric($offset)?" OFFSET {$offset} ":"");
 376+ function limitResult($sql, $limit,$offset) {
 377+ return "$sql LIMIT $limit ".(is_numeric($offset)?" OFFSET {$offset} ":"");
378378 }
379379
380380 /**
Index: trunk/phase3/includes/QueryPage.php
@@ -160,7 +160,9 @@
161161 # Clear out any old cached data
162162 $dbw->delete( 'querycache', array( 'qc_type' => $this->getName() ), $fname );
163163 # Do query
164 - $res = $dbr->query( $this->getSQL() . $this->getOrder() . $dbr->limitResult( 1000,0 ), $fname );
 164+ $sql = $this->getSQL() . $this->getOrder();
 165+ $sql = $dbr->limitResult($sql, 1000,0);
 166+ $res = $dbr->query($sql, $fname);
165167 $num = false;
166168 if ( $res ) {
167169 $num = $dbr->numRows( $res );
@@ -237,7 +239,8 @@
238240 }
239241 }
240242
241 - $sql = $dbr->limitResult($sql . $this->getOrder(), $limit, $offset);
 243+ $sql .= $this->getOrder();
 244+ $sql = $dbr->limitResult($sql, $limit, $offset);
242245 $res = $dbr->query( $sql );
243246 $num = $dbr->numRows($res);
244247
@@ -304,7 +307,8 @@
305308 $feed->outHeader();
306309
307310 $dbr =& wfGetDB( DB_SLAVE );
308 - $sql = $this->getSQL() . $this->getOrder().$dbr->limitResult( 50, 0 );
 311+ $sql = $this->getSQL() . $this->getOrder()
 312+ $sql = $dbr->limitResult( $sql, 50, 0 );
309313 $res = $dbr->query( $sql, 'QueryPage::doFeed' );
310314 while( $obj = $dbr->fetchObject( $res ) ) {
311315 $item = $this->feedResult( $obj );
Index: trunk/phase3/includes/SearchMySQL.php
@@ -86,7 +86,7 @@
8787 * @access private
8888 */
8989 function queryLimit() {
90 - return $this->db->limitResult('', $this->limit, $this->offset );
 90+ return $this->db->limitResult( '', $this->limit, $this->offset );
9191 }
9292
9393 /**
Index: trunk/phase3/includes/Database.php
@@ -1278,11 +1278,11 @@
12791279 * Construct a LIMIT query with optional offset
12801280 * This is used for query pages
12811281 */
1282 - function limitResult($sql, $limit, $offset) {
1283 - return "$sql LIMIT ".((is_numeric($offset) && $offset != 0)?"{$offset},":"")."{$limit} ";
 1282+ function limitResult($limit, $offset=false) {
 1283+ return " LIMIT ".((is_numeric($offset) && $offset != 0)?"{$offset},":"")."{$limit} ";
12841284 }
1285 - function limitResultForUpdate($sql, $num) {
1286 - return $this->limitResult($sql, $num, 0);
 1285+ function limitResultForUpdate($num) {
 1286+ return $this->limitResult($num, 0);
12871287 }
12881288
12891289 /**

Status & tagging log