From 170b674a0953ce95e06f7a8442eb0f1097e7ee72 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 16 Mar 2003 07:02:20 +0000 Subject: - 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. --- modules/book.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/book.module') diff --git a/modules/book.module b/modules/book.module index 5c5eb1b79..2d13bd46c 100644 --- a/modules/book.module +++ b/modules/book.module @@ -513,7 +513,7 @@ function book_tree($parent = 0, $depth = 3) { function book_render() { - $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 AND n.status = 1 AND (n.moderate = 0 OR n.revisions != '') ORDER BY b.weight, n.title"); + $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 AND n.status = 1 AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title"); while ($page = db_fetch_object($result)) { // load the node: @@ -555,7 +555,7 @@ function book_page() { } function book_print($id = "", $depth = 1) { - $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '%d' AND (n.moderate = 0 OR n.revisions != '') ORDER BY b.weight, n.title", $id); + $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = '%d' AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title", $id); while ($page = db_fetch_object($result)) { // load the node: @@ -582,7 +582,7 @@ function book_print($id = "", $depth = 1) { } function book_print_recurse($parent = "", $depth = 1) { - $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND b.parent = '$parent' AND (n.moderate = 0 OR n.revisions != '') ORDER BY b.weight, n.title"); + $result = db_query("SELECT n.nid FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND b.parent = '$parent' AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title"); while ($page = db_fetch_object($result)) { // load the node: @@ -756,4 +756,4 @@ function book_help() { +?> \ No newline at end of file -- cgit v1.2.3