Fix RDBI rollback
This commit is contained in:
parent
d7cbee5dbb
commit
26150b85bd
|
@ -19,11 +19,7 @@ sub store {
|
||||||
$req = $self->_dbh->prepare(
|
$req = $self->_dbh->prepare(
|
||||||
"INSERT INTO $self->{dbiTable} (cfgNum,field,value) VALUES (?,?,?)");
|
"INSERT INTO $self->{dbiTable} (cfgNum,field,value) VALUES (?,?,?)");
|
||||||
|
|
||||||
if ( $lastCfg == $cfgNum ) {
|
_delete($self,$cfgNum) if $lastCfg == $cfgNum;
|
||||||
my $r =
|
|
||||||
$self->_dbh->prepare("DELETE FROM $self->{dbiTable} where cfgNum=?");
|
|
||||||
$r->execute($cfgNum);
|
|
||||||
}
|
|
||||||
unless ($req) {
|
unless ($req) {
|
||||||
$self->logError;
|
$self->logError;
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
|
@ -35,6 +31,7 @@ sub store {
|
||||||
print STDERR $@ if $@;
|
print STDERR $@ if $@;
|
||||||
unless ($execute) {
|
unless ($execute) {
|
||||||
$self->logError;
|
$self->logError;
|
||||||
|
_delete( $self, $cfgNum ) if $lastCfg != $cfgNum;
|
||||||
$self->_dbh->do("ROLLBACK");
|
$self->_dbh->do("ROLLBACK");
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -63,5 +60,11 @@ sub load {
|
||||||
return $self->unserialize($res);
|
return $self->unserialize($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _delete {
|
||||||
|
my ( $self, $cfgNum ) = @_;
|
||||||
|
my $r =
|
||||||
|
$self->_dbh->prepare("DELETE FROM $self->{dbiTable} where cfgNum=?");
|
||||||
|
$r->execute($cfgNum);
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user