服务器表检测数据的一致性

my $table_name1 = shift;#表
my $data211 = shift;#服务器1上表的数据
my $data12 = shift;#服务器2上表的数据

my %hash1;
my %hash2;
my $search_difference1;
my $search_difference2;

for(my $i=0;$i<scalar(@$data12);$i++){
my $hash_one = $data12->[$i];
my $str = "";

for my $d12(sort keys %$hash_one){
if(!defined $hash_one->{$d12}){
$hash_one->{$d12} = "";
}
$str .= $hash_one->{$d12}."##";
}
$hash1{$str} = 1;
}

for(my $j=0;$j<scalar(@$data211);$j++){
my $hash_one1 = $data211->[$j];
my $str1 = "";
for my $d211(sort keys %$hash_one1){
if(!defined $hash_one1->{$d211}){
$hash_one1->{$d211} = "";
}
$str1 .= $hash_one1->{$d211}."##";
}
$hash2{$str1} = 1;
}
foreach(keys %hash1){
if(exists $hash2{$_}){
}else{
Encode::from_to($_,'utf8','gb2312');
print MYTXT "服务器1上$table_name1表不存在:$_的数据\n";
}
}
foreach(keys %hash2){
if(exists $hash1{$_}){
}else{
Encode::from_to($_,'utf8','gb2312');
print MYTXT "服务器2上$table_name1表不存在:$_的数据\n";
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值