[dev] Fwd: Horde_Rdo_Query with wildcard characters

Jan Schneider jan at horde.org
Thu Oct 6 15:36:58 UTC 2016


----- Weitergeleitete Nachricht von Sebastian Birnbach  
<birnbacs at gmail.com> -----
  Datum: Thu, 6 Oct 2016 17:25:43 +0200
    Von: Sebastian Birnbach <birnbacs at gmail.com>
Betreff: Re: [dev] Horde_Rdo_Query with wildcard characters
     An: Jan Schneider <jan at horde.org>

       Right, easy out. Thanks for looking into this!

Since we're at it: is it considered a feature that wildcards are not  
used in '=' queries? Seems to me there wouldn't be no harm and  
virtually no effort permitting them.

  Seb.

   2016-10-06 15:53 GMT+02:00 Jan Schneider <jan at horde.org>:

> Please don't top-post and please respond to the list.
>
> Zitat von Sebastian Birnbach <birnbacs at gmail.com>:
>  
>
>>> Zitat von Sebastian Birnbach <birnbacs at gmail.com>:
>>>
>>> All,
>>>
>>>> I am working on an Rdo_Query that depends on data a user submits in a
>>>> form.
>>>> Everything works well except that SQL wildcard characters like '%' and '_'
>>>> do not work.
>>>>
>>>> A query, for example, for "1234" returns one object. A query for "123%",
>>>> however, does not.
>>>>
>>>> In the latter case the query according to getQuery() is:
>>>> array(2) {
>>>>   [0]=>
>>>>   string(142) "SELECT customer, ourref FROM mytable WHERE mytable.`ourref`
>>>> = ? OR mytable.`yourref` = ? ORDER BY ourref DESC LIMIT 20"
>>>>   [1]=>
>>>>   array(2) {
>>>>     [0]=>
>>>>     string(4) "123%"
>>>>     [1]=>
>>>>     string(4) "123%"
>>>>   }
>>>> }
>>>>
>>>> This looks good to me, the query is well formatted, the bind parameters
>>>> are
>>>> correct, everything is right in place. I tried adding single ticks around
>>>> the search string and escaping the wildcard with an exclamation mark, but
>>>> to no avail.
>>>>
>>>> Thanks for your help
>>>>
>>>>   Sebastian
>>>>  
>>>
>>> How do you expect it to work? Should the wildcard characters be used as
>>> such in the actual query, or are you trying to search that string
>>> literally. Only the latter is supported and makes sense at this abstraction
>>> level.
>>>  
>>
>> Jan,
>>
>> I was hoping that since the SQL query is already ready to fire it would
>> simply get output to the database, not changing possible wildcards.
>>
>> Although I cannot see why it would not make sense to support wildcards on
>> this abstraction level there is probably a wise decision behind this. Will
>> it make sense to use a Horde_Db_Adapter_Mysql for my purposes? Or is
>> processing of wildcards also unsupported on lower level?
>
> Scratch everything I said, the wildcards are not escaped, but used  
> as-is. You didn't use them correctly though. Wildcards are used in  
> LIKE queries only.
>
> --
> Jan Schneider
> The Horde Project
> http://www.horde.org/
>
> --
> dev mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org

----- Ende der weitergeleiteten Nachricht -----
-------------------------
Jan Schneider
The Horde Project
http://www.horde.org/


More information about the dev mailing list