Strange bug in freetds
Ravi Krishna <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Version Freetds 0.82, DBI 1.53 and DBD 1.08OS: Linux 64 bit RHEL5
Is this a DBD/DBI issue or freetds issue?
This code works like a charm
use strict ;use DBI ;my $dbh = DBI->connect("DBI:Sybase:server=..."; # passwd removed$dbh->{PrintError} = 1 ;$dbh->{RaiseError} = 1 ;$dbh->do("begin tran");$dbh->do("insert into rrr values(1)");$dbh->do("insert into rrr values(1)");$dbh->do("insert into rrr values(1)");$dbh->do("commit tran");$dbh->disconnect ;exit(0);
# All I am doing above is to insert three rows with a tran and then commit it.
# This one fails. This one prepares the insert statement instead of literal sql.
use strict ;use DBI ;my $dbh = DBI->connect("DBI:Sybase:server=..."; # passwd removed$dbh->{PrintError} = 1 ;$dbh->{RaiseError} = 1 ;my $sth = $dbh->prepare("insert into rrr values(?)") ;$dbh->do("begin tran");$sth->execute(1);$sth->execute(1);$sth->execute(1);$dbh->do("commit tran");$dbh->disconnect ;exit(0);
DBD::Sybase::db do failed: Server message number=3902 severity=16 state=1 line=1 server=aaa text=The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. at ./x.pl line 13.DBD::Sybase::db do failed: Server message number=3902 severity=16 state=1 line=1 server=aaa text=The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. at ./x.pl line 13.
# OK so I added the following:
$dbh->{AutoCommit} = 0 ;
#Now I get this error
Panic: Can't have multiple statement handles on a single database handle when AutoCommit is OFF at ..perlmod/lib/site_perl/5.8.9/x86_64-linux-thread-multi/DBD/Sybase.pm line 129.Issuing rollback() for database handle being DESTROY'd without explicit disconnect() at ../perlmod/lib/site_perl/5.8.9/x86_64-linux-thread-multi/DBD/Sybase.pm line 129.