At 05:28 AM 6/8/01 -0700, Randal L. Schwartz wrote:
> >>>>> "Jeff" == Jeff Yoak <[EMAIL PROTECTED]> writes:
>
>Jeff> I'm coming in on the middle of a thread here, but generally the best
>Jeff> thing to do when working with databases in Perl is to us DBI, and if
>Jeff> you are doing that, database handles have a method called quote() that
>Jeff> will ensure that the value in question is properly quoted for the
>Jeff> database you are using.  That way, you don't have to loose things like
>Jeff> apostrophes.  For instance, omitting error checking for brevity:
>
>I wouldn't say best.  Placeholders are even more cool, and require
>less thinking.

What do you mean by placeholders?


>$dbh->do("insert into foo (bar, baz) values (?, ?)", undef,
>          $bar, $baz);
>
>Does the same thing as quote, with a lot less typing!

True, but my purpose what to display quote() explicitly in case it might be 
needed in more complex constructions involving statement handlers and the 
like.  I guess, come to think of it, you can always get around explicit 
quoting and this shows another feature that is generally useful.

Cheers,
Jeff


Reply via email to