in reply to Re: Re: Re: How to Speed up MySQL w/ Perl
in thread How to Speed up MySQL w/ Perl

Hey Dave,

I think I understand placeholders now. Is it also possible to do this:
my $insert = $dbh->prepare("insert into table values (?,?,?)"); while (something) { $insert->execute($var1,$var2,$var3); } # end-while
Cheers,
Reagen

Replies are listed 'Best First'.
Re: How to Speed up MySQL w/ Perl
by Abigail-II (Bishop) on May 26, 2004 at 10:56 UTC
    Is it also possible to do this
    Instead of just saying "yes" or "no", I give you a counter question: what happened when you tried?

    Abigail

      Touche :)

      Thankyou. I sometimes need a slap on the wrist to stop myself becoming lazy :~)

      Cheers,
      Reagen
Re: Re: Re: Re: Re: How to Speed up MySQL w/ Perl
by runrig (Abbot) on May 26, 2004 at 17:00 UTC
    Better to get in the habit of specifying your column values:
    my $insert = $dbh->prepare("insert into table (column1, column2, column3) values (?,?,?)");
    OT, but the only time I don't do this is outside of Perl where the language lets me declare record variables like a table:
    define some_record like some_table.* insert into some_table some_record.*
    And even this breaks when columns get out of order between the time you compile the program and run it, so column order becomes one more thing to maintain, and it's better to not have to maintain one more thing. :)