Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Apr 2006 at 16:47 UTC
Updated:
25 Apr 2006 at 18:16 UTC
If you set up any handlers to create LIKE '%%' queries where the queried text starts with the letters b, f, s, or b (like a query that ends up as LIKE '%b%') the query will fail. It has to do with the fact that those are special characters used in DB_QUERY_REGEXP. They either get thrown out of the query or changed into other values. I got far enough in debugging this to see that the % used as a wildcard in the sql is getting confused with sending something like %b to the REGEXP. The percent sign needs to be escaped or something, but I don't know enough about REGEXP to fix this.
Comments
Comment #1
karens commentedTo be more specific, in case there is someone out there who knows what the fix is, in line 578 of views_query.inc the sql clause is run through preg_replace_callback(DB_QUERY_REGEXP, '_db_query_callback', $clause); and that's were the sql is picking up the wrong value -- a clause like LIKE '%b%' turns into LIKE '''%'.
Comment #2
karens commentedI finally figured out the answer, you need four(4) percent signs where you would normally have a sql wildcard character (LIKE '%%%%b%' will become LIKE '%b%')
Comment #3
karens commentedForgot to mark this fixed.
Comment #4
(not verified) commented