Todays most recent version of views [DRUPAL-5:1.166.2.32] Plus todays views_alpha_pager [DRUPAL-5:1.5.2.18]

Although I got alpha_pager working without any filters applied, and also working with a filter but no alpha pager, trying them both together produced errors which included the bad SQL:
... FROM node node WHERE (. IN ('')) ORDER BY ... and dying

I traced this to line views_alpha_pager.module line# 150
where it seemed it was trying to execute the pre-rewrite query string
... FROM {node} node WHERE (%s.%s IN ('%s')) ORDER BY ...
but no arguments were being passed in!

So. Although I'm not totally understanding all the magic that the 'query' object is doing these days, I repaired what I needed by passing in the arguments:
From

  $result = db_query($countquery);

to

 $result = db_query($countquery,$query->where_args);

... There may be other arguments that should be passed there, but I'm scared to go looking.

Patch attached

CommentFileSizeAuthor
fix_filter_sql_error.patch.txt780 bytesdman

Comments

douggreen’s picture

Status: Needs work » Fixed

This looks right and didn't break my test case. I've committed it to the 5.x-dev branch. Thanks!

douggreen’s picture

Status: Fixed » Closed (fixed)