Commit 26150b85 authored by Yadd's avatar Yadd
Browse files

Fix RDBI rollback

parent d7cbee5d
Pipeline #14373 passed with stage
in 14 minutes and 29 seconds
...@@ -19,11 +19,7 @@ sub store { ...@@ -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 { ...@@ -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 { ...@@ -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__
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment