问题
I have an issues on Web application programming with Firebird.
I'm using mod_perl and Apache::DBI with Firebird.
And also using CGI::Session
for session handling.
CGI::Session
uses an already connected $dbh
with Firebird.
AutoCommit is ON.
Every(multiple) sql execution is wrapped by eval {}
statement.
for example,
$dbh = DBI->connect("dbi:Firebird:db=$DBSERVER:/home/cdbs/xxnet.fdb;
ib_charset=UTF8;ib_dialect=3",$DBUSER,$DBPASS,{
AutoCommit=>1,
LongReadLen=>8192,
RaiseError=>1
});
eval { $dbh->begin_work()
my $sql = "SELECT * FROM SAMPLETABLE"
my $st = $dbh->prepare($sql);
$st->execute();
while (my $R = $st->fetchrow_hashref()) {
...
}
$st->finish();
}; warn $@ if $@;
if ($@) {
$dbh->rollback();
}else{
$dbh->commit();
}
When an exception was raised in eval section, execute warn statement and try to rollback transaction.
Error messages are logged in error_log,after that, $dbh
is going to get stuck -- CGI::Session returns no data.
I thought 'warn' statement includes 'rollback', so I tried to comment out $dbh->rollback()
statement. It looks good.
Other ways, I use 'warn' to log debug message -- like print STDERR $@
.
httpd is going to get stuck like as above.
With Oracle(DBD::Oracle), I didn't see these situation.
Please tell me which part is BAD for using transaction with firebird ? warn ? DBD::Firebird ?
Thanks.
Yasuto,
来源:https://stackoverflow.com/questions/42981824/programming-with-apachedbi-and-firebird-get-stucked-httpd-on-exception