'offset ? limit ?' is supported by more than 'limit ?, ?'

This commit is contained in:
Shish 2010-04-23 16:09:43 +01:00
parent 509486e690
commit 8a08571325
3 changed files with 6 additions and 11 deletions

View File

@ -126,7 +126,7 @@ class Blotter extends SimpleExtension {
private function display_blotter() {
global $database, $config;
$limit = $config->get_int("blotter_recent", 5);
$entries = $database->get_all("SELECT * FROM blotter ORDER BY id DESC LIMIT ?,?", array(0, $limit));
$entries = $database->get_all("SELECT * FROM blotter ORDER BY id DESC LIMIT ?", array($limit));
$this->theme->display_blotter($entries);
}
}

View File

@ -275,7 +275,7 @@ class Pools extends SimpleExtension {
"INNER JOIN users AS u ".
"ON p.user_id = u.id ".
"ORDER BY p.date DESC ".
"LIMIT ?, ?"
"OFFSET ? LIMIT ?"
, array($pageNumber * $poolsPerPage, $poolsPerPage)
);
@ -452,7 +452,7 @@ class Pools extends SimpleExtension {
INNER JOIN images AS i ON i.id = p.image_id
WHERE p.pool_id = ? AND i.rating IN ($rating)
ORDER BY p.image_order ASC
LIMIT ?, ?",
OFFSET ? LIMIT ?",
array($poolID, $pageNumber * $imagesPerPage, $imagesPerPage));
$totalPages = ceil($database->db->GetOne("
@ -468,7 +468,7 @@ class Pools extends SimpleExtension {
FROM pool_images
WHERE pool_id=?
ORDER BY image_order ASC
LIMIT ?, ?",
OFFSET ? LIMIT ?",
array($poolID, $pageNumber * $imagesPerPage, $imagesPerPage));
$totalPages = ceil($database->db->GetOne("SELECT COUNT(*) FROM pool_images WHERE pool_id=?", array($poolID)) / $imagesPerPage);
}
@ -588,7 +588,7 @@ class Pools extends SimpleExtension {
"INNER JOIN users AS u ".
"ON h.user_id = u.id ".
"ORDER BY h.date DESC ".
"LIMIT ?, ?"
"OFFSET ? LIMIT ?"
, array($pageNumber * $historiesPerPage, $historiesPerPage));
$totalPages = ceil($database->db->GetOne("SELECT COUNT(*) FROM pool_history") / $historiesPerPage);

View File

@ -70,12 +70,7 @@ class AliasEditor implements Extension {
$alias_per_page = $config->get_int('alias_items_per_page', 30);
if($database->engine->name == "mysql") {
$query = "SELECT oldtag, newtag FROM aliases ORDER BY newtag ASC LIMIT ?, ?";
}
else {
$query = "SELECT oldtag, newtag FROM aliases ORDER BY newtag ASC OFFSET ? LIMIT ?";
}
$query = "SELECT oldtag, newtag FROM aliases ORDER BY newtag ASC OFFSET ? LIMIT ?";
$alias = $database->db->GetAssoc($query,
array($page_number * $alias_per_page, $alias_per_page)
);