您可以告诉我如何循环&在Perl中重命名MySQL表。谢谢。如何在Perl中循环并重新命名MySQL表
我的代码片段连接
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect(
'DBI:mysql:database=dbdev;host=localhost',
'dbdev',
'dbdevpw',
{ RaiseError => 1, AutoCommit => 1 },
);
my $sql = RENAME TABLE old_table TO new_table;
my $sth = $dbh->prepare($sql);
while (<DATA>){
chomp;
// How to implement the Rename all the old tables with the while loop.
$sth->execute();
}
什么是这个问题的downvote? – 2010-04-15 14:59:53