Code does not generate parentheses around multiple string terms, resulting in syntax error.
Example:
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 ''ASmith', 'GJones') ORDER BY node_data_field_reg_no_field_reg_no_v' at line 13 query: SELECT DISTINCT node_data_field_status.field_pi_last_value AS node_data_field_status_field_pi_last_value, node.type AS node_type, node.nid AS nid, node.vid AS node_vid, node_data_field_status.field_pi_first_value AS node_data_field_status_field_pi_first_value, node_data_field_status.field_reg_no_value AS node_data_field_status_field_reg_no_value, node.title AS node_title, node_data_field_status.field_updated_on_value AS node_data_field_status_field_updated_on_value, node_data_field_reg_no.field_reg_no_value AS node_data_field_reg_no_field_reg_no_value FROM drupal_node node LEFT JOIN drupal_content_type_registration node_data_field_status ON node.vid = node_data_field_status.vid LEFT JOIN drupal_content_type_registration node_data_field_reg_no ON node.vid = node_data_field_reg_no.vid WHERE (node.type in ('registration')) AND ((node_data_field_status.field_status_value) = ('Active')) AND (node_data_field_status.field_pi_full_value IN 'ASmith', 'GJones') ORDER BY node_data_field_reg_no_field_reg_no_value ASC LIMIT 0, 10 in .../docroot/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 1146.
I made the following change to views_handler_argument_string.inc
if (count($this->value) > 1) {
$operator = 'IN';
- $placeholders = implode(', ', array_fill(0, sizeof($this->value), "'%s'"));
+ $placeholders = '(' . implode(', ', array_fill(0, sizeof($this->value), "'%s'")) . ')';
Comments
Comment #1
dawehnerGreat. Commited to 6.x-3.x
Next time you could also create a patch file to save us some seconds.
Comment #2
dawehnerAnd even more important fix possible c&p errors.
Comment #3
GRRaka commentedMy first "contribution" to Drupal.
I'll do better next time.
Comment #4
dawehnerJust wanted to say :) This will be hopefull the first of many .