Re: Re: PEAR::DB 1.6.4 problem with quoteSmart()

From: Date: Thu, 24 Jun 2004 07:49:25 +0000
Subject: Re: Re: PEAR::DB 1.6.4 problem with quoteSmart()
References: 1 2 3 4 5 6 7  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13431@lists.php.net to get a copy of this message
Oops, bad example. You could use an editor which highlights the argument when you click on an identifier, that makes it a lot easier. I still think the benefits - non obfuscated query - looks exactly like a prepared statement - much easier to convert to other languages etc outweigh the few small problems. Having the query in pure SQL rather than mixed with PHP definitely makes it easier to debug and much easier read in my opinion! Of course you've got to do what works for you! "Justin Patrin" <papercrane@gmail.com> wrote in message news:432beae04063023588f4e559@mail.gmail.com... > Also, quoteSmart is for quoting values, not identifiers. The correct > function for this is quoteIdentifier(): > > $query = 'select * from '.$db->quoteIdentifier($table); > > On Thu, 24 Jun 2004 15:31:28 +1000, Aidan Lister <aidan@php.net> wrote: > > > > Hi Torsten, > > > > On a side note, a good way of writing your queries is using sprintf(); > > > > $query = sprintf("select * from %s", quotesmart($database)); > > > > This removes the PHP from the queries making them much more portable and > > less obfuscated. > > > > "Torsten Roehr" <roehr@zilleon.com> wrote in message > > news:20040630184535.62320.qmail@pb1.pair.com... > > > > > > > "Stephan Schmidt" <schst@php.net> wrote in message > > > news:40E305DA.2020409@php.net... > > > > Hi, > > > > > > > > Torsten Roehr wrote: > > > > > > > > > Thanks, Michael. Now I see what the 'smart' stands for... Have to > > adapt > > > all > > > > > my SQL statements now. > > > > > > > > If you do not want DB to place quotes around your values, you may also > > > > use escapeSimple(). > > > > > > > > > http://pear.php.net/manual/en/package.database.db.db-common.escapesimple.php > > > > > > > > Stephan > > > > > > Thanks, Stephan! Could have seen this myself, arrrgh... > > > > > > Torsten > > > > -- > > PEAR General Mailing List (http://pear.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > !DSPAM:40e39fbb36908669215710! > > > > > > > > > -- > paperCrane --Justin Patrin--

« previous php.pear.general (#13431) next »