eval 捕获错误

eval 捕获错误:
[root@dr-mysql01 ~]# cat t1.pl
use DBI;
my $dbUser='zabbix';
my $user="root";
my $passwd="1234567";
my $dbh = DBI->connect("dbi:mysql:database=zabbix;host=192.168.32.55;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr;
eval {
#alter table trends drop partition p20160425;
my $sql="alter table history drop partition p20160501;";
print "\$sql is $sql\n";
$dbh->do("$sql");
};
print $@;
[root@dr-mysql01 ~]# perl t1.pl
$sql is alter table history drop partition p20160501; [root@dr-mysql01 ~]# cat t1.pl
use DBI;
my $dbUser='zabbix';
my $user="root";
my $passwd="1234567";
my $dbh = DBI->connect("dbi:mysql:database=zabbix;host=192.168.32.55;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr;
eval {
#alter table trends drop partition p20160425;
my $sql="alter table history drop partition p20160401;";
print "\$sql is $sql\n";
$dbh->do("$sql");
};
print $@;
[root@dr-mysql01 ~]# perl t1.pl
$sql is alter table history drop partition p20160401;
DBD::mysql::db do failed: Error in list of partitions to DROP at t1.pl line 10.
上一篇:Mac下安装Wireshark,双击闪退


下一篇:PCA 协方差矩阵特征向量的计算