when selecting "both" user warning: The used SELECT statements ... on line 498
jannalexx - May 8, 2009 - 02:54
| Project: | Content Management Filter |
| Version: | 6.x-1.6 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
user warning: The used SELECT statements have a different number of columns query: SELECT COUNT(*) FROM drupal_node n INNER JOIN drupal_users u ON n.uid = u.uid AND u.uid = 1 UNION SELECT c.cid, c.nid, c.subject AS title, c.comment, n.type, u.name AS username, u.uid, c.status, c.timestamp AS created, 0 AS changed FROM drupal_comments c INNER JOIN drupal_node n ON c.nid = n.nid INNER JOIN drupal_users u ON u.uid = c.uid AND u.uid = 1
in return pager_query
line: isset($_SESSION['cmf_max_rows']) ? $_SESSION['cmf_max_rows'] : 50, 0, NULL, $args);

#1
results are ok but:
user warning: The used SELECT statements have a different number of columns query: SELECT COUNT(*) FROM drupal_node n INNER JOIN drupal_users u ON n.uid = u.uid AND u.uid = 1 UNION SELECT c.cid, c.nid, c.subject AS title, c.comment, n.type, u.name AS username, u.uid, c.status, c.timestamp AS created, 0 AS changed FROM drupal_comments c INNER JOIN drupal_node n ON c.nid = n.nid INNER JOIN drupal_users u ON u.uid = c.uid AND u.uid = 1 in /.../sites/all/modules/cmf/cmf.module on line 498.
#2
You are going to have to provide a count query. This seems to do the trick:
$count_query = 'SELECT COUNT(*) FROM {node} n'.' INNER JOIN {users} u ON n.uid = u.uid '
. $filter['join']
. $filter['where']
.' UNION SELECT COUNT(*) FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid '
.' INNER JOIN {users} u ON u.uid = c.uid '
. $filter['join']
. $filter['where'];
And, of course, the pager_query needs to specify this.
#3
#4
See patch in #517880: Coding standards
#5
Committed to both -dev versions.
#6
Included in new release.