Posted by erikseifert on July 22, 2010 at 1:11pm
2 followers
| Project: | Privatemsg Views |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Pager doesnt work.
This code do for your default views
<?php
function mymodule_views_pre_execute(&$view) {
if ( $view->name == 'privatemsg_mailbox' ) {
$view->build_info['count_query'] = 'SELECT (pm_message.mid) FROM {pm_message} pm_message INNER JOIN {pm_index} pm_index ON pm_message.mid = pm_index.mid WHERE (pm_index.deleted = 0) AND (pm_index.uid = %d)';
}
}
?>
Comments
#1
Thanks for the tip, but the query you're suggesting is wrong. There's no GROUP BY or DISTINCT in it thus it doesn't represent base query. You are simply counting messages, we OTOH need to count threads.
But I would like to avoid the approach, cause it works in a limited way and is closely tied to the supplied view. Would be best to work out a solution that worked for all views.
#2
#3
For anyone interested, I described the problem in the Views queue: #904284: Count query optimization code only checks $this->groupby and not presence of "aggregate" fields.
#4
Attaching temporary fix until the aforementioned request is answered
#5
Better patch from the root of the module.
#6
I've committed the patch above to the dev branch. Not closing this issue to wait for proper solution.
#7
Ok, since this is fixed in dev, changing to a task.
#8