I propose the following patch to add a standard views option list designed to be used with LIKE queries. The options are all, contains, does not contain, start with, ends with. It would go with the list of other default filter handlers.

Comments

karens’s picture

StatusFileSize
new1.57 KB

Actually, I'd like to adjust the patch to add a standard LIKE query filter that goes with the LIKE options. I thinks this could be used in many places, which is why I propose adding it to the views module.

merlinofchaos’s picture

I am absolutely in agreement, and will likely commit a patch like this.

However, one change I made is to allow add_where to accept standard %s and %d arguments like db_query (and I am likely to go back at some point and fix how that works so I am not doing it myself, but that's another story) -- and while I haven't gone back and fixed all of Views' handlers to use this, new handlers should respect that as a security precaution.

Other than that, the patch looks good.

(Also, KarenS, thank you -- I've seen you commenting on several Views issues and I really appreciate other people who have gained some knowledge of the system helping out while my availability is poor. While I expect my time to free back up in 2 or 3 weeks, I'm still barely available and I appreciate the effort in helping out -- even if it's just on the easy ones!)

karens’s picture

StatusFileSize
new1.7 KB

merlinofchaos, you are welcome, I'm happy to try to help out. You did all the heavy lifting here, I'm just glad to have this module available.

I ran into a problem with the wildcard character in LIKE queries (described at http://drupal.org/node/58280.) The attached fixed patch takes care of this.

karens’s picture

StatusFileSize
new1.7 KB

A slight change to the patch so that the queries use %s instead of the raw input value.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed! Thank you very much for your efforts!

Anonymous’s picture

Status: Fixed » Closed (fixed)