If you try this call:
/api/test/node?parameters[type]=wiki&fields=nid,type
The query will fail.
In node_resource.inc line 291:
// Build an array of fields with the appropriate placeholders for use in
// db_query().
foreach ($parameters as $field => $value) {
$where[] = $field . ' = ' . db_type_placeholder($schema['fields'][$field]['type']);
}
// Now implode that array into an actual WHERE clause.
$where = !empty($where) ? ' WHERE '. db_escape_string(implode(' AND ', $where)) : '';
db_type_placeholder wraps the placeholder in quotes then db_escape_string escapes the quotes which is unnecessary and breaks the query. The db_escape_string is not needed because db_query will take care of that during binding.
Comments
Comment #1
perceptum commentedI have confirmed this - and have altered my code as suggested above, which works well
Comment #2
kylebrowning commentedThanks ! heres a patch, do test!
Comment #3
gddCommitted, thanks!