This adds support for the views subqueries patch at http://drupal.org/node/143888 (this is required for views_fastsearch) - note that this has nothing to do with views_union subqueries :)

The support is transparent - if the views subqueries patch is not present nothing will be done. I think this would be good to add because the kind of people who need complex things like views_union also likely need complex things like views_fastsearch!

CommentFileSizeAuthor
subquery.patch647 bytesowen barton

Comments

Anonymous’s picture

Status: Needs review » Needs work

I'm hesitant about this. This would cause unexpected problems if the phrase [SUBQUERY] appears in the data. It seems like we'd need some more sophisticated parsing, so that it would only change the actual subqueries and not mentions of [SUBQUERY] in the data.

Let me see...
A query that it works on would be like this?

SELECT thing FROM {a} A, [SUBQUERY] B WHERE A.blah=B.thing AND A.blah='Hello, World';

right?

So something like this would still work:

SELECT thing FROM {a} A, [SUBQUERY] B WHERE A.blah=B.thing AND A.blah='I\'ve got a cool [SUBQUERY]';

because the str_replace would only replace the first instance of [SUBQUERY] and it would be correct.

But something like:

SELECT thing, 'check out my [SUBQUERY]' FROM {a} A, [SUBQUERY] B WHERE A.blah=B.thing AND A.blah='Hello, World';

is valid SQL but this patch wouldn't do it correctly.

It may be the case that we could never produce a query like that, and that all the data would occur after all possible instances of [SUBQUERY]. Can we prove that?