Commit fcda6671 authored by Dan McGee's avatar Dan McGee Committed by Lukas Fleischer
Browse files

SQL: use standard LIMIT/OFFSET syntax



Increases compatibility with standard SQL dialect.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: default avatarDan McGee <dan@archlinux.org>
Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent ed9c9562
......@@ -32,7 +32,7 @@ $rss->image = $image;
$dbh = db_connect();
$q = "SELECT * FROM Packages ";
$q.= "ORDER BY SubmittedTS DESC ";
$q.= "LIMIT 0 , 20";
$q.= "LIMIT 20";
$result = db_query($q, $dbh);
while ($row = mysql_fetch_assoc($result)) {
......
......@@ -119,7 +119,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
}
$order = ($by == 'asc') ? 'ASC' : 'DESC';
$lim = ($limit > 0) ? " LIMIT $off, $limit" : "";
$lim = ($limit > 0) ? " LIMIT $limit OFFSET $off" : "";
$by_next = ($by == 'desc') ? 'asc' : 'desc';
$q = "SELECT * FROM TU_VoteInfo WHERE End > " . time() . " ORDER BY Submitted " . $order;
......
......@@ -405,7 +405,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="",
break;
}
$search_vars[] = "SB";
$q.= "LIMIT ". $OFFSET . ", " . $HITS_PER_PAGE;
$q.= "LIMIT " . $HITS_PER_PAGE . " OFFSET " . $OFFSET;
$dbh = db_connect();
......
......@@ -501,7 +501,7 @@ function pkg_search_page($SID="") {
break;
}
$q_limit = "LIMIT ".$_GET["O"].", ".$_GET["PP"];
$q_limit = "LIMIT ".$_GET["PP"]." OFFSET ".$_GET["O"];
$q = $q_select . $q_from . $q_from_extra . $q_where . $q_sort . $q_limit;
$q_total = "SELECT COUNT(*) " . $q_from . $q_where;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment