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.
Currently a lot of operator methods doesn't work.
Here is a patch and a test file
Comment | File | Size | Author |
---|---|---|---|
#15 | 1007730-filter_string.patch | 11.17 KB | dawehner |
#13 | 1007730-filter_string.patch | 10.41 KB | dawehner |
#12 | 1007730-filter_string.patch | 10.64 KB | dawehner |
#10 | views_handler_filter_string.test | 10.92 KB | dawehner |
#9 | 1007730-filter_string.patch | 9.28 KB | dawehner |
Comments
Comment #1
dawehnerHere are the files.
The tests aren't passing at the moment.
Comment #2
dawehneradditional information:
Comment #3
bojanz CreditAttribution: bojanz commentedSo, do we kill the "case sensitive" option completely?
We already say "MySQL might ignore case sensitivity.", so if now postgres is the same I'm not sure there's much we can or should do.
Also,
Bluurgh. Took me a few seconds to realize that this is actually generating a placeholder. Should it then find a home in views_plugin_query_default?
Since we had the same placeholder problem in arguments, would be good to solve it across the board.
Comment #4
dawehnerCool. So we can drop this feature in general.
-------
My idea here was to generate a unique but somehow readable placeholder.
We could use a counter-placeholder-method in views_plugin_query_default , right.
Comment #5
bojanz CreditAttribution: bojanz commentedThe placeholder trick is really neat. We just need to move it to views_plugin_query_default, rename it, give it some docs, and make sure it works in all situations (will it work for those arguments in subqueries? We have some complicated queries...)
I'll reroll the patch for case sensitivity.
Comment #6
dawehnerIn contrast to ***FOO*** this is a real dbtng placeholder, so if this doesn't work this is a core bug, or?
Sadly this nice trick with __FUNCTION__ and __CLASS___ don't work in query_default, but it's okay.
Comment #7
bojanz CreditAttribution: bojanz commentedYeah, I overlooked that little fact.
Leaving the topic alone for now then, and just providing a reroll.
Btw, shouldn't op_contains() get the same db_like() treatment?
I'll take another peek at this issue when I come home tonight, my brain is refusing to boot up at the moment.
Comment #8
bojanz CreditAttribution: bojanz commentedBetter patch (last one left one instance of 'case').
Note that we need to fix views_handler_argument_string the same way.
Comment #9
dawehner* renamed variable_name to unique_placeholder
* moved the method to the views_handler class
* fixed the argument string
* fixed op_contains
A full test is somehow required here :)
Comment #10
dawehnerAfter quite a lot of work a full test is added.
This test passes with the patch above.
Comment #11
bojanz CreditAttribution: bojanz commentedAwesome.
Was wondering whether we should add a counter to the unique_placeholder() function, so that we can use it multiple times from the same function (which will surely be needed).
In general, I'm having mixed feelings about unique_placeholder in views_handler. On one side, it makes debugging easier, since I can easily see where the placeholder is coming from. On the other hand, it's a dbtng specific function in a handler, code that should generally be in the specific query plugin.
Comment #12
dawehnerSo here is an update.
Comment #13
dawehnerNew version.
Comment #14
bojanz CreditAttribution: bojanz commentedKill both, they are unused
Comment #15
dawehnerRemoved placeholder_count, too.
Added views_handler::placeholder based on the latest idea.
Tests are .... passing
This aren't a lot of passes for this big amount of code.
Comment #16
bojanz CreditAttribution: bojanz commentedhttp://drupal.org/cvs?commit=470112
A follow-up will be to convert all code to use the new placeholder method.
Best done after add_where_expression() lands (or simultaneously, since it touches the same code)