diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-03-16 07:02:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-03-16 07:02:20 +0000 |
commit | 170b674a0953ce95e06f7a8442eb0f1097e7ee72 (patch) | |
tree | 11778666b2fc94cceaa947aea21a71bde0195380 /modules/blog.module | |
parent | 6dc1cf59ba2ca58f0b4200d820a23dc5f35ec1fb (diff) | |
download | brdo-170b674a0953ce95e06f7a8442eb0f1097e7ee72.tar.gz brdo-170b674a0953ce95e06f7a8442eb0f1097e7ee72.tar.bz2 |
- All LIMIT queries must go through the pager or through db_query_range().
The syntax for db_query_range() was enhanced so it matches db_query(). So
you may pass extra arguments of the SQL statement which are checked via
check_query() and then substituted into the SQL statement. After these
optional arguments, you always pass $from and $count parameters which
define your range. Most often, the $from is 0 and the count is the max
number of records you want returned. Patch by Moshe.
- The pager_query() function for PEAR was enhanced so that it adds proper
GROUP BY statement counting the number of records to be paged. Patch by
James Arthur.
- MSSQL database scheme by Moshe.
Diffstat (limited to 'modules/blog.module')
-rw-r--r-- | modules/blog.module | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/blog.module b/modules/blog.module index 8646ea3f3..f8cd33d1f 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -86,7 +86,7 @@ function blog_feed_user($uid = 0) { $account = $user; } - $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '%d' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15", $uid); + $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = '%d' AND n.status = 1 ORDER BY n.nid DESC", $uid, 0, 15); $channel["title"] = $account->name. "'s blog"; $channel["link"] = url("blog/view/$uid"); $channel["description"] = $term->description; @@ -94,7 +94,7 @@ function blog_feed_user($uid = 0) { } function blog_feed_last() { - $result = db_query("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 15"); + $result = db_query_range("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC", 0, 15); $channel["title"] = variable_get("site_name", "drupal") ." blogs"; $channel["link"] = url("blog/view"); $channel["description"] = $term->description; @@ -242,7 +242,7 @@ function blog_block($op = "list", $delta = 0) { } else { if (user_access("access content")) { - $block["content"] = node_title_list(db_query("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC LIMIT 10")); + $block["content"] = node_title_list(db_query_range("SELECT u.uid, u.name, n.created, n.title, n.nid FROM node n LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC", 0, 10)); $block["content"] .= "<div align=\"right\" id=\"blog_more\">". l(t("more"), "blog", array("title" => t("Read the latest blog entries."))) ."</div>"; $block["subject"] = t("User blogs"); } |