When setting up a view with a single argument that was a nodereferrer, an SQL error is generated. The problem is in the query() function in views/nodereferrer_view_handler_argument.inc. I don't entirely understand how the queries are compiled, but it's clear that in the call to $this->query->add_where(), the operator (i.e. $this->options['operator']) is null, as is the group. This means that no operator is given and invalid SQL results. I solved it for my case by checking to see if the operator was null, and setting it to 'in' if so. This may not be the correct general solution.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 443444_in.patch | 854 bytes | andypost |
Comments
Comment #1
andypostCan you provide a case when you get this error?
Comment #2
adraskoy commentedI just upgraded to the latest versions of all modules. Still getting this:
The relevant section is inserted by nodereferrer: WHERE node.nid (50, 33, 32, 31, 30, 25, 3, 2)
as you can see, it should have the word "IN" before the list of node number in parens.
vacation_day is a CCK type with node references field_vacation and field_day_photo referring to CCK types vacation and photo. This view (and the query with the error) shows all the "vacation day" nodes referring to the current vacation node.
There is a related issue, probably around the same part of the code where all vacation days would be retrieved instead of none if there were no referrers.
Comment #3
adraskoy commentedComment #4
andypost@adraskoy Are you using 'Operator' "in" or "not in" ?
Comment #5
adraskoy commentedI'm using Operator: "in". The view has a node for an argument, and I am using nodereferrer here to grab all the nodes that have a node reference to that argument node.
Comment #6
andypostPlease try new beta2 which have relation for views
UPDATE: and provide steps to reproduce
Comment #7
adraskoy commentedThe issue is still there. I've been fixing it by adding the following two lines around line 95 of views/nodereferrer_view_handler_argument.inc
Comment #8
andypostLet's try this patch
Suppose we need more testing maybe this change touching other places
Comment #9
andypostCommited, tnx http://drupal.org/cvs?commit=307254