summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-03-24 06:11:38 +0100
committermkanat%bugzilla.org <>2007-03-24 06:11:38 +0100
commit1463ef1599f942025ba67aeae96d5c3b6301db7a (patch)
treeb1559b8b73e325cbb6a705e39721618b82f5abf2 /Bugzilla
parentfce3b9626675493b2afb9ce09ab7e59aaea82317 (diff)
downloadbugzilla-1463ef1599f942025ba67aeae96d5c3b6301db7a.tar.gz
bugzilla-1463ef1599f942025ba67aeae96d5c3b6301db7a.tar.xz
Bug 374016: Use transactions to create bugs
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 78c939b98..daebaf701 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -264,6 +264,8 @@ sub create {
my $class = shift;
my $dbh = Bugzilla->dbh;
+ $dbh->bz_start_transaction();
+
$class->check_required_create_fields(@_);
my $params = $class->run_create_validators(@_);
@@ -291,10 +293,6 @@ sub create {
my $timestamp = $params->{creation_ts};
delete $params->{creation_ts};
- $dbh->bz_lock_tables('bugs WRITE', 'bug_group_map WRITE',
- 'longdescs WRITE', 'cc WRITE', 'keywords WRITE', 'dependencies WRITE',
- 'bugs_activity WRITE', 'fielddefs READ');
-
my $bug = $class->insert_create_data($params);
# Add the group restrictions
@@ -342,6 +340,12 @@ sub create {
$sth_bug_time->execute($timestamp, $blocked_id);
}
+ $dbh->bz_commit_transaction();
+
+ # Because MySQL doesn't support transactions on the longdescs table,
+ # we do this after we've committed the transaction. That way we're
+ # fairly sure we're inserting a good Bug ID.
+
# And insert the comment. We always insert a comment on bug creation,
# but sometimes it's blank.
my @columns = qw(bug_id who bug_when thetext);
@@ -357,7 +361,6 @@ sub create {
$dbh->do('INSERT INTO longdescs (' . join(',', @columns) . ")
VALUES ($qmarks)", undef, @values);
- $dbh->bz_unlock_tables();
return $bug;
}