运行存储过程时,Perl DBD::SQLAnywhere挂起

运行存储过程时,Perl DBD::SQLAnywhere挂起,perl,sqlanywhere,Perl,Sqlanywhere,我们有一个旧的遗留应用程序运行在SQLAnywhere 11上。在使用新软件时,我们首先要对遗留系统进行数据验证。 我正在使用perl自动化这个过程 首先向数据库添加一个存储过程,然后执行它,最后从表中选择结果 现在 使用perl代码创建SP-OK 使用perl代码-NOK执行SP 在sql编辑器中运行SP,然后使用perl代码获取结果-OK 当我试图从perl代码执行SP时,脚本只是挂起 脚本: #!/usr/bin/perl -w use strict; use DBI; use File:

我们有一个旧的遗留应用程序运行在SQLAnywhere 11上。在使用新软件时,我们首先要对遗留系统进行数据验证。 我正在使用perl自动化这个过程

首先向数据库添加一个存储过程,然后执行它,最后从表中选择结果

现在 使用perl代码创建SP-OK 使用perl代码-NOK执行SP 在sql编辑器中运行SP,然后使用perl代码获取结果-OK

当我试图从perl代码执行SP时,脚本只是挂起

脚本:

#!/usr/bin/perl -w
use strict;
use DBI;
use File::Slurp;
use Data::Dumper;

my $dbh;

sub createConnection{
  my $uid = shift;
  my $pwd = shift;

  my $conn = DBI->connect("DBI:SQLAnywhere:ENG=ENG_NAME",
          "UID=$uid;PWD=$pwd;DBN=dbn;LINKS=tcpip(host=IP;port=port)") or die "Cannot connect to database: $DBI::errstr\n";

  return $conn;
}

sub createProcedure{
    my $procedure = read_file('data_check.sql', binmode => ':utf8');

    $dbh->do($procedure);
}

sub executeProcedure{
    my $sth = $dbh->prepare('CALL prDataCheck(?,?,?);');
    $sth->bind_param(1, '2014-01-14');
    $sth->bind_param(2, 'FSK');
    $sth->bind_param(3, 'Y');
    $sth->execute();

}

sub getResult{
     my $sth = $dbh->prepare('select * from result_table;');
     $sth->execute();
    my $response = $sth->fetchrow_hashref();
    print Dumper $response . "\n";

}


$dbh = createConnection("xxx", "yyy");

createProcedure();
executeProcedure();
getResult();





END{
  $dbh->disconnect;
}
  exit(0);
我尝试过以各种方式执行SP:

第一次尝试

$dbh->do("CALL prDataCheck('2014-01-14','FSK','Y');")
第二次尝试

my $sth = $dbh->prepare('CALL prDataCheck(?,?,?);');
$sth->bind_param(1, '2014-01-14');
$sth->bind_param(2, 'FSK');
$sth->bind_param(3, 'Y');
$sth->execute();
我在执行脚本时尝试过设置DBI->trace(3): 但没什么收获

Executing Procedure ..
Go ..
    -> prepare for DBD::SQLAnywhere::db (DBI::db=HASH(0x28042c8)~0x2804208 'call prDataCheck(?,?,?);') thr#2342010
scanned 3 distinct placeholders
    <- prepare= ( DBI::st=HASH(0x2804550) ) [1 items] at dataCheck.pl line 29 via  at dataCheck.pl line 59
executing
    -> execute for DBD::SQLAnywhere::st (DBI::st=HASH(0x2804550)~0x2804268 '2014-01-13' 'FSK' 'Y') thr#2342010
         bind :p1 <== '2014-01-14' (type 0)
Binding input hostvar ':p1' to ordinal 1
         bind :p2 <== 'FSK' (type 0)
Binding input hostvar ':p2' to ordinal 2
         bind :p3 <== 'Y' (type 0)
Binding input hostvar ':p3' to ordinal 3
有人能帮我解释一下吗? 我有点困了。。 我尝试过针对SQLAnywhere 11和SQLAnywhere 16中的SDK编译DBD::SQLAnywhere

韩元
Marcus

您可能需要提交更改。我想这是一个交易问题

semop(4816896, {{0, -1, SEM_UNDO}}, 1)  = 0