in reply to Re^2: mySQL Times Out / Disconnects
in thread mySQL Times Out / Disconnects
Search for that term in the DBI manual, read carefully to understand all the ways they can make your code better, and work it into your code. Basically, you create a query string with one or more question mark characters where a value would be -- each question mark is a "placeholder" for a value. Then you do $sth=$dbh->prepare($statement) in the normal way, and when you execute it, you pass values for each placeholder: $sth->execute(@values) (or $sth->execute($val1,$val2,...)), as shown in the code I posted above.
I was considering the Load Data Local Infile things, but realized my limitation when I needed to compare stuff before the Inserting/Updating happens.
I'm not understanding what your "limitation" is. You just open an output file before the loop; within the loop, instead of executing an insert statement, you print a line to the file; after the loop you close the file and execute a "LOAD DATA LOCAL INFILE ..." statement. You can't use this approach for the updates -- those still need to be executed on each loop iteration.
(updated to improve grammar)
|
|---|