[nycphp-talk] Re: New PHundamentals Article
Daniel Convissor
danielc at analysisandsolutions.com
Tue Jan 6 13:22:19 EST 2004
Hi Folks:
On Tue, Jan 06, 2004 at 12:47:08PM -0500, David Mintz wrote:
>
> DB::quote() (and I quote) "[q]uotes a string database-dependent, so it can
> be safely used in a query." They mean, it quotes it correctly for the
> backend db that you connected to when you called connect() and got a $db
> object. They further say the currently supported database backends are
> MySQL, PostgreSQL, InterBase, Mini SQL, Microsoft SQL Server, Oracle
> 7/8/8i, ODBC (Open Database Connectivity), SyBase, Informix, FrontBase.
I'm now maintaining PEAR DB. Exactly what quote() -- and potentiall new
similar methods -- is going to do is under discussion. The last release
has different behaviors for different databases.
While all db's get the string escaped, some db's return everything quoted
(with "'" around them) while numeric _strings_ and/or _variables_ passed
to the method may or may not get quotes around them.
Under MySQL, ODBC, PostgreSQL full magic was in effect based on the PHP
data type of the variable passed to the method. I've committed several
changes to apply this behavior to most backends. This raised cackles from
some about forward compatibility and too much magic, so the final behavior
has yet to be determined.
I'm leaning to having all of them do the magic and have the same default
behavior without creating yet another method.
We'll see...
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
More information about the talk
mailing list