BUG: active record like() adds \ before _ |
[eluser]jmadsen[/eluser]
Just tracked this down, don't have time at the moment to do a full bug report on git but wanted to record/ask before I forget: Using version 2.1.1, when using active record like() function, this_is_my_slug becomes this\_is\_my\_slug traced it back to DB_Driver Code: function escape_like_str($str) followed by the mysql driver, escape_str() function ... Code: function escape_str($str, $like = FALSE) there's no way to avoid $like = TRUE, and so turn off the added slashes Has this been seen already for v3.0, or can somebody confirm my findings? TIA, Jeff
[eluser]Aken[/eluser]
It's not a bug - the underscore is a special wildcard character when using pattern matching with LIKE. The slashes are used to escape them so they are treated as actual underscore characters.
[eluser]jmadsen[/eluser]
yes, but the bug is you can't turn it off when you don't want to pattern match. Try doing a " LIKE this_is_underscored%" search - you can't. At minimum, needs documented
[eluser]Aken[/eluser]
And it has already been addressed in 3.0. The docs could use updating, though.
|
Welcome Guest, Not a member yet? Register Sign In |