well most of what I'm going to say is standard DBI fare. If you're going to be inserting multiple records into the same table a structure like this is preferred for speed and security.
That prevents the statement from being repeatedly prepare by the database handle.my %items_to_insert = (item1=>1, item2=>2); $statement = "INSERT INTO myTbl (itemName,itemNumber) VALUES(?,?); my $sth = $dbh->prepare($statement); foreach my $key (keys(%items_to_insert)) { $sth->execute($key,$items_to_insert{$key}); }
I would say that one call to a fetch_all type statement in DBI rather than individual row fetching would be preferred as well. You minimize the total network traffic that way (correct me if wrong here)
So in summary, my big points of advice for DBI in this case are
In reply to Re: Improving on MS-SQL over DBI and DBD::ODBC
by Grygonos
in thread Improving on MS-SQL over DBI and DBD::ODBC
by radiantmatrix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |