diff options
author | mkanat%bugzilla.org <> | 2007-03-24 05:10:01 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2007-03-24 05:10:01 +0000 |
commit | fce3b9626675493b2afb9ce09ab7e59aaea82317 (patch) | |
tree | 92f2f9bf1a1d171928a53ab15cb0ecaf219f0cbd | |
parent | 0eb69c790cf7138445f5f063430b53053b4b745b (diff) | |
download | bugs-fce3b9626675493b2afb9ce09ab7e59aaea82317.tar bugs-fce3b9626675493b2afb9ce09ab7e59aaea82317.tar.gz bugs-fce3b9626675493b2afb9ce09ab7e59aaea82317.tar.bz2 bugs-fce3b9626675493b2afb9ce09ab7e59aaea82317.tar.xz bugs-fce3b9626675493b2afb9ce09ab7e59aaea82317.zip |
Bug 374012: Use transactions inside of Bugzilla::Object
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
-rw-r--r-- | Bugzilla/Object.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index 6775d4719..ee1be2f9f 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -171,6 +171,8 @@ sub update { my $table = $self->DB_TABLE; my $id_field = $self->ID_FIELD; + $dbh->bz_start_transaction(); + my $old_self = $self->new($self->id); my (@update_columns, @values, %changes); @@ -199,6 +201,8 @@ sub update { $dbh->do("UPDATE $table SET $columns WHERE $id_field = ?", undef, @values, $self->id) if @values; + $dbh->bz_commit_transaction(); + return \%changes; } @@ -210,9 +214,13 @@ sub create { my ($class, $params) = @_; my $dbh = Bugzilla->dbh; + $dbh->bz_start_transaction(); $class->check_required_create_fields($params); my $field_values = $class->run_create_validators($params); - return $class->insert_create_data($field_values); + my $object = $class->insert_create_data($field_values); + $dbh->bz_commit_transaction(); + + return $object; } sub check_required_create_fields { |