You may want to check into controlling the Auto Commit attribute of the DBI connection.
(This relates to the notion of transaction handling mentioned above.) I know from personal experience (on a mirrored My SQL server) that Auto Commit being on vs.
The solution would be to get back to basics by writing the SQL yourself.
By the way, you should not call your DBIx:: Simple $dbh.
This is the common name for DBI objects, and objects of classes that inherit from DBI.
Using the name $dbh for DBIx:: Simple objects is kind of confusing. My question is: can we get the same 'prepare' effects as moritz mentioned in his post, since 'prepare' is done before the while loop..:) BTW.
Within a few minutes of uploading a distribution to CPAN, it’s indexed and installable by anyone with a CPAN client, which is pretty incredible.
This avoids mistakes like accidentally running the script with system Perl.
Are you always updating the one table, or is the code simply an example?
Assuming it's not just illustrative, I'd do: You might want to look into the documentation for your database, as there's likely a bulk-loading ability to handle this sort of replacement. For mysql, use the 'LOAD DATA LOCAL INFILE' command with the 'REPLACE' keyword.
Nov 14, 2016 by David Farrell If you’ve got a Perl script that does something useful, you might want to put it on CPAN.
Becoming a CPAN author is a rite-of-passage for Perl programmers, you’ll learn about the CPAN infrastructure and sharing code is a nice thing to do.