in reply to Re: How to optimise " csv into mysql " using Text:CSV_XS and DBD::Mysql
in thread How to optimise " csv into mysql " using Text:CSV_XS and DBD::Mysql

The usage of placeholders in the OP's code is secure and normal; maybe a little idiomatic but common. There's no programmatic difference between–

$sth = $dbh->prepare("something something ?, ?"); $sth->execute(@args);

–and–

$place = "?, ?"; $sth = $dbh->prepare("something something $place"); $sth->execute(@args);

Replies are listed 'Best First'.
Re^3: How to optimise " csv into mysql " using Text:CSV_XS and DBD::Mysql
by chacham (Prior) on Aug 06, 2015 at 14:38 UTC

    But it isn't "something something", its "$fieldList."

      Ah, quite right... seems to be trusted data. But still quite right.

        seems to be trusted data

        Trusted data does make a good case for a quick and dirty solution, certainly if it is an ad hoc, temporary solution. However, it may engender the use of dynamic sql elsewhere. Or worse, stick around for a while and even get copied into other scripts because "it works."

        Personally, i often find that taking the time (and pain) of doing it correctly teaches me a few things.