BUU has asked for the wisdom of the Perl Monks concerning the following question:

Is there any point, or advantage, to using placeholders if your only going to do one insert/select before the script ends?

Edit kudra, 2002-05-05 Modified title based upon reply and body

  • Comment on DBI Placeholders useful for single insert/select?

Replies are listed 'Best First'.
Re: Placeholders yet again.
by Corion (Patriarch) on May 05, 2002 at 19:29 UTC

    I guess you mean SQL place holders under DBI - yes, there is a very good reason, quoting.

    If you manually construct your SQL queries, you have to escape all nasty characters like spaces, commas (with quotes) and most disturbing and error prone, apostrophes (') and binary values. Placeholders alleviate you of that onus, so they are a good thing to use, even just for a one-shot script.

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: DBI Placeholders useful for single insert/select?
by samgold (Scribe) on May 06, 2002 at 03:42 UTC
    What dws says is very true, I have had that problem before and believe me what a pain that was. If you are just writing a simple select statement like:
    SELECT * FROM table WHERE 1 = 1;
    then no it is not worth it.
A reply falls below the community's threshold of quality. You may see it by logging in.