Fixes for the use of LIMIT in SQL for Postgres 7.3 (from Petri Asikainen)

This commit is contained in:
moodler
2003-02-18 03:16:07 +00:00
parent e10ed4f09f
commit c2a96d6b32
2 changed files with 19 additions and 9 deletions
+10 -4
View File
@@ -811,11 +811,17 @@ function get_users_count() {
function get_users_listing($sort, $dir="ASC", $page=1, $recordsperpage=20) {
global $CFG;
if ($CFG->dbtype == "mysql") {
$limit = "LIMIT $page,$recordsperpage";
} else {
$limit = "LIMIT $recordsperpage,$page";
switch ($CFG->dbtype) {
case "mysql":
$limit = "LIMIT $page,$recordsperpage";
break;
case "postgres7":
$limit = "LIMIT $recordsperpage OFFSET ".($page * $recordsperpage);
break;
default:
$limit = "LIMIT $recordsperpage,$page";
}
return get_records_sql("SELECT id, username, email, firstname, lastname, city, country, lastaccess
FROM {$CFG->prefix}user
WHERE username <> 'guest'
+9 -5
View File
@@ -420,13 +420,17 @@ function forum_search_posts($search, $courseid, $page=0, $recordsperpage=50) {
$notteacherforum = "";
}
if ($CFG->dbtype == "mysql") {
$limit = "LIMIT $page,$recordsperpage";
} else {
$limit = "LIMIT $recordsperpage,$page";
switch ($CFG->dbtype) {
case "mysql":
$limit = "LIMIT $page,$recordsperpage";
break;
case "postgres7":
$limit = "LIMIT $recordsperpage OFFSET ".($page * $recordsperpage);
break;
default:
$limit = "LIMIT $recordsperpage,$page";
}
return get_records_sql("SELECT p.*,u.firstname,u.lastname,u.email,u.picture
FROM {$CFG->prefix}forum_posts p,
{$CFG->prefix}forum_discussions d,