우리는 SQL Anywhere 11에서 실행되는 오래된 레거시 응용 프로그램을 가지고 있습니다. 새 소프트웨어로 이동할 때 우리는 먼저 레거시 시스템에서 데이터 유효성 검사를 수행합니다. 이 절차를 자동화하기 위해 perl을 사용하고 있습니다.저장 프로 시저를 실행할 때 Perl DBD :: SQLAnywhere가 응답하지 않는다
먼저 데이터베이스에 저장 프로 시저를 추가 한 다음 실행하고 테이블에서 결과를 마지막으로 선택하여 수행됩니다. 펄 코드를 사용하여 SP를 만들기
이제 - OK 펄 코드를 사용하여 SP를 실행 - 펄 코드를 사용하여 결과를 가져 오는 다음 NOK 는 SQL 편집기에서 SP를 Runnoing을하고 - OK
I을 스크립트가 단순히 멈추는 perl 코드에서 SP를 실행하십시오.
스크립트 : 내가 설정을 시도
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();
첫 번째 시도
$dbh->do("CALL prDataCheck('2014-01-14','FSK','Y');")
두 번째 시도 :
#!/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를 실행하기 위해 노력했다DBI-는> 트레이스 (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
동작을받지 것은 내가 실행하기위한 어떠한 방식을 사용하더라도 동일합니다.
나는 또한 스크립트를 실행할 때 strace를 사용해 보았지만 결과물에는별로 언급하지 않았다. 그냥
semop(4816896, {{0, -1, SEM_UNDO}}, 1) = 0
누군가 나를 위해이 되거 주실 래요 .. 기다리고있는 것 같다? 나는 다소 붙어있다. sqlanywhere11과 sqlanywhere16에서 찾을 수있는 SDK에 대해 DBD :: SQLAnywhere 컴파일을 시도했다.
Kr을 마커스