Re: [Dbi-interbase-devel] bug in tpb ?
Status: Beta
Brought to you by:
edpratomo
From: Ritz D. <dan...@gm...> - 2001-12-25 17:13:52
|
the problem is that the dbd starts a default transaction after connect() or after AutoCommit is set to 0. set_tx_param only changed the TBP but didn't start a new transaction.... i made some changes already commited to sourceforge cvs, the changelog is: - no longer start a default transaction on connect or after AutoCommit is set to 0 - set_tx_param closes all statement handles and commit transaction in AutoCommit mode - with AutoCommit = 0 the new set TPB applies after a new transaction is started (old closed after commit() or rollback(), or with the first prepare() or do() if set_tx_param is called directly after DBI->connect() ) - updated doc for set_tx_param making this clear should fix this: -daniel ----- Original Message ----- From: "Pavel Zheltouhov" <pa...@tv...> To: "DBD-InterBase Devel" <dbi...@li...> Sent: Tuesday, December 25, 2001 12:54 PM Subject: [Dbi-interbase-devel] bug in tpb ? > > this code worked properly only if commits called > before operators > second insert must be failed but locked. > > is it bug or feature ? > > use DBI; > # create table ltab (a int not null,name char(15) not null, > # constraint ltab_pk primary key ( a ,name )); > # > my $dbname='localhost:/tmp/z.gdb'; > > my $dbh1 = DBI->connect("dbi:InterBase:db=$dbname;ib_dialect=3", > 'sysdba','masterkey', > {AutoCommit => 0,RaiseError => 1 }) || die "can't connect\n"; > my $dbh2 = DBI->connect("dbi:InterBase:db=$dbname;ib_dialect=3", > 'sysdba','masterkey', > {AutoCommit => 0,RaiseError => 1 }) || die "can't connect\n"; > > $dbh1->func( > -access_mode => 'read_write', > -lock_resolution => 'no_wait', > 'set_tx_param'); > $dbh2->func( > -access_mode => 'read_write', > -lock_resolution => 'no_wait', > 'set_tx_param'); > $stmt = "INSERT INTO ltab VALUES(?, 'Yustina')"; > > $dbh1->commit; # if this commits not called - tpb will lost ! > $dbh2->commit; > > $dbh1->do($stmt, undef, 1); # must pass > $dbh2->do($stmt, undef, 1); # must fail > $dbh1->commit; > $dbh2->commit; > $dbh1->disconnect; > $dbh2->disconnect; > > -- > Pavlo > > > _______________________________________________ > Dbi-interbase-devel mailing list > Dbi...@li... > https://lists.sourceforge.net/lists/listinfo/dbi-interbase-devel > |