0
我正在使用一個簡單的perl腳本來混淆mysql數據庫表中的數百萬行。我在腳本中使用了perl DBI和DBD :: mysql。下面的示例代碼使用perl批量插入到mysql數據庫表
my $dbh = DBI->connect(<DB INFO>);
my $sth;
my $insert_com = "INSERT INTO TAB1 VALUES(?,?,?,?,?)";
for (1..50000000){
$sth = $dbh->prepare($insert_com);
$sth->execute(<val1>,<val2>,<val3>,<val4>,<val5>);
}
根據上面的代碼,我認爲每循環迭代發送一次提交。 我的問題是,是否有可能每n次迭代發送一次提交?即在向表中插入n行之後提交。如果可能的話,有人可以告訴我如何。提前致謝。乾杯......
可能重複單行插入20K行](http://stackoverflow.com/questions/22164070/mysql-insert-20k-rows-in-single-insert) – 2014-09-10 09:09:25
以'$ sth = $ dbh-> prepare($ insert_com);'語句出循環 – 2016-05-11 14:01:10