Re: Re: PEAR::DB 1.6.4 problem with quoteSmart()
| From: | Justin Patrin | Date: | Thu, 01 Jul 2004 06:57:28 +0000 |
| Subject: | Re: Re: PEAR::DB 1.6.4 problem with quoteSmart() | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13429@lists.php.net to get a copy of this message | ||
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.
Not IMHO. First, sprintf is less efficient that using concatenation.
Second, using sprintf, if you have multiple replacements, you have to
look through the parameters in order to find the one that matches.
It's much easier to read in-line concatenation. If you're having
trouble, I suggest getting an editor that supports syntax
highlighting.
>
> "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--