summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-03-24 06:10:01 +0100
committermkanat%bugzilla.org <>2007-03-24 06:10:01 +0100
commitfce3b9626675493b2afb9ce09ab7e59aaea82317 (patch)
tree92f2f9bf1a1d171928a53ab15cb0ecaf219f0cbd /Bugzilla
parent0eb69c790cf7138445f5f063430b53053b4b745b (diff)
downloadbugzilla-fce3b9626675493b2afb9ce09ab7e59aaea82317.tar.gz
bugzilla-fce3b9626675493b2afb9ce09ab7e59aaea82317.tar.xz
Bug 374012: Use transactions inside of Bugzilla::Object
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Object.pm10
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 {