Index: trunk/phase3/includes/SpecialLog.php |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | $sql .= " WHERE " . implode( ' AND ', $this->whereClauses ); |
156 | 156 | } |
157 | 157 | $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 ); |
159 | 159 | return $sql; |
160 | 160 | } |
161 | 161 | |
Index: trunk/phase3/includes/DatabasePostgreSQL.php |
— | — | @@ -372,8 +372,8 @@ |
373 | 373 | return ''; |
374 | 374 | } |
375 | 375 | |
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} ":""); |
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
Index: trunk/phase3/includes/QueryPage.php |
— | — | @@ -160,7 +160,9 @@ |
161 | 161 | # Clear out any old cached data |
162 | 162 | $dbw->delete( 'querycache', array( 'qc_type' => $this->getName() ), $fname ); |
163 | 163 | # 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); |
165 | 167 | $num = false; |
166 | 168 | if ( $res ) { |
167 | 169 | $num = $dbr->numRows( $res ); |
— | — | @@ -237,7 +239,8 @@ |
238 | 240 | } |
239 | 241 | } |
240 | 242 | |
241 | | - $sql = $dbr->limitResult($sql . $this->getOrder(), $limit, $offset); |
| 243 | + $sql .= $this->getOrder(); |
| 244 | + $sql = $dbr->limitResult($sql, $limit, $offset); |
242 | 245 | $res = $dbr->query( $sql ); |
243 | 246 | $num = $dbr->numRows($res); |
244 | 247 | |
— | — | @@ -304,7 +307,8 @@ |
305 | 308 | $feed->outHeader(); |
306 | 309 | |
307 | 310 | $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 ); |
309 | 313 | $res = $dbr->query( $sql, 'QueryPage::doFeed' ); |
310 | 314 | while( $obj = $dbr->fetchObject( $res ) ) { |
311 | 315 | $item = $this->feedResult( $obj ); |
Index: trunk/phase3/includes/SearchMySQL.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | * @access private |
88 | 88 | */ |
89 | 89 | function queryLimit() { |
90 | | - return $this->db->limitResult('', $this->limit, $this->offset ); |
| 90 | + return $this->db->limitResult( '', $this->limit, $this->offset ); |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
Index: trunk/phase3/includes/Database.php |
— | — | @@ -1278,11 +1278,11 @@ |
1279 | 1279 | * Construct a LIMIT query with optional offset |
1280 | 1280 | * This is used for query pages |
1281 | 1281 | */ |
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} "; |
1284 | 1284 | } |
1285 | | - function limitResultForUpdate($sql, $num) { |
1286 | | - return $this->limitResult($sql, $num, 0); |
| 1285 | + function limitResultForUpdate($num) { |
| 1286 | + return $this->limitResult($num, 0); |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | /** |