RE: [PHP-DEV] Re: [PHP] PDO prepared statements and LIKE escaping
| From: | Texin, Tex | Date: | Wed, 06 Aug 2008 17:11:10 +0000 |
| Subject: | RE: [PHP-DEV] Re: [PHP] PDO prepared statements and LIKE escaping | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39707@lists.php.net to get a copy of this message | ||
If you are supporting international users, then you also have to worry about the full-width versions
of the operators (%, *, etc.)
Whether they are treated the same as half-width characters depends on the database. Oracle for
example treats them as equivalent.
-----Original Message-----
From: Lester Caine [mailto:lester@lsces.co.uk]
Sent: Tuesday, August 05, 2008 12:35 AM
To: PHP internals
Subject: [PHP-DEV] Re: [PHP] PDO prepared statements and LIKE escaping
Larry Garfield wrote:
> I'm building a multi-database system, although my main targets are
> MySQL, Postgres, and SQLite.
>
> How would those handle something like "a string that ends in 100%"?
Personally this is one of the reasons that PDO has never attracted me.
Providing the tools to flatten some of the differences between *SQL* variations is just as important
as flattening the name differences in functions.
My own use of LIKE tends to process the string and then add the wrapping %% when passing it to the
param array, but do all databases HANDLE 'escaped %' in the LIKE data? Firebird allows a
escape character but you need to include it in the SQL LIKE '%100#%%' ESCAPE '#'
But I think MySQL actually uses \% to achieve the same thing - and the ESCAPE '\' is then
optional?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve -
http://enquirysolve.com/ Model Engineers Digital Workshop -
http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php
--
PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php