RE: AutoCommit does not work
- From: mfanderson@xxxxxxxxxxx (Mary Anderson)
- Date: Tue, 22 Aug 2006 10:23:52 -0700 (PDT)
Artem Harutyunyan wrote:Hi,
___________________________________________________________________________
Consider, please, the following piece of code:
______
my $dbh = DBI->connect($dsn, $user, $pass, {RaiseError =>___________________________________________________________________________
1,PrintError =>1});
$dbh->{'AutoCommit'} = 0;
my $sth = $dbh->prepare(q{INSERT INTO TRANSACTION(toGroup, fromGroup,
amount) VALUES(?,?,?)});
eval{
$sth->execute("kuku","DADDY","3.14");
print "Going to sleep...\n\n\n";
sleep (60);
};
if ($@) {
print "Error !!!\n\n";
$dbh->rollback();
exit(-2);
}
$dbh->commit();
______
It connects to the database, turns AutoCommit off, prepares the
statement,
executes it, waits for 60 seconds and commits the statement.
Although I do not get any errors, it does not work as I expect. The
problem
is that I can see the new entry inside the table before $dbh->commit() is
called from the code. The same problem appears also when
$dbh->begin_work
is used.
The underlying database is mySQL version 5.0.24 and the version of DBI is
1.50.
Could you please, give any hints how to debug the problem ?
Thanks in advance,
Artem.
Artem,
In MySQL your table must be of type INNOB for transactions to be
supported.
HTH
Mary>
.
- Follow-Ups:
- Re: AutoCommit does not work
- From: Artem Harutyunyan
- Re: AutoCommit does not work
- Prev by Date: Re: Re: AutoCommit does not work
- Next by Date: RE: Re: AutoCommit does not work
- Previous by thread: Re: Re: AutoCommit does not work
- Next by thread: Re: AutoCommit does not work
- Index(es):
Relevant Pages
|
|