Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi Ron,
I added the Biblio: Authors field to a view, and got the following error:
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',) AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,,) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',) AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,,) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN () AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN () AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',,2866) AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,,,2866) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',,2866) AND auth_category=1 ORDER BY bc.rank' at line 3 query: SELECT * FROM drupal_biblio_contributor bc INNER JOIN drupal_biblio_contributor_data bcd ON bc.cid = bcd.cid WHERE vid IN (,,,2866) AND auth_category=1 ORDER BY bc.rank in /usr/local/webapp/phudev.dlcdev.com/sites/all/modules/biblio/views/biblio_handler_field_contributor.inc on line 51.
The first thing I noticed is that empty strings are being passed to the query (WHERE vid IN (,,,2866)
). Here's a patch to biblio_handler_field_contributor.inc, which does 2 things:
* Makes sure not to add empty results to the $vids array, and
* Optimizes the query if $vids has only 1 item in the array, to use '=' instead of 'IN'.
It's not as pretty as it could be (ideally the db_query syntax would use %d & '%s' replacements etc), but it's not ugly either - and seems to work for now ;)
Comment | File | Size | Author |
---|---|---|---|
#1 | biblio_492214_biblio_handler_field_contributor.patch | 1.56 KB | scottrigby |
Comments
Comment #1
scottrigbypatch attached
Comment #2
rjerome CreditAttribution: rjerome commentedThanks Scott,
As you can see, the Views integration is a work is progress, and any fixes/additions/suggestions are welcome!
Ron.
Comment #3
rjerome CreditAttribution: rjerome commentedForgot to mention that this was committed to CVS,
Ron.