Closed (duplicate)
Project:
Drupal core
Version:
6.x-dev
Component:
base system
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2007 at 15:19 UTC
Updated:
6 Aug 2008 at 19:45 UTC
I've wondered why pager_query() returned me 41 results, when there were only 36 nodes in the table.
Reason: db_result in combination with a multi-line SQL string misses to match a query (see below) that contains tabs or newlines.
$query = "
SELECT
n.nid,
n.title,
n.uid,
n.type,
n.status,
n.created,
u.name AS username
FROM
{node} n
...
";
The attached patch properly checks for whitespace instead of space-character and matches also the above query.
| Comment | File | Size | Author |
|---|---|---|---|
| pager_count-query-matching.diff.txt | 800 bytes | spiffl |
Comments
Comment #1
aufumy commentedTested on pager.inc revision 1.62, and indeed the sql query on different lines returned only the first page of 10 nodes, instead of 4 pages of 35 nodes.
Applying the patch produced the correct results.
Comment #2
gábor hojtsyWhy do we restrict the ORDER BY to work with spaces only then?
Comment #3
damien tournoud commentedNow a duplicate of #288837: Pager.inc regexp misses whitespace use case, even if this one is older.