diff options
author | 2007-10-10 04:21:48 +0000 | |
---|---|---|
committer | 2007-10-10 04:21:48 +0000 | |
commit | 24a90239690d3c59538cb4044bc31411efd83464 (patch) | |
tree | 09242819613a0cd56319b09bf258077dce147d70 /editcomponents.cgi | |
parent | Midair with product change while adding an attachment silently clears flags -... (diff) | |
download | bugzilla-24a90239690d3c59538cb4044bc31411efd83464.tar.gz bugzilla-24a90239690d3c59538cb4044bc31411efd83464.tar.bz2 bugzilla-24a90239690d3c59538cb4044bc31411efd83464.zip |
Bug 398976: edit*.cgi scripts should use transactions for database interaction - Patch by Emmanuel Seyman <eseyman@linagora.com> r/a=mkanat
Diffstat (limited to 'editcomponents.cgi')
-rwxr-xr-x | editcomponents.cgi | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/editcomponents.cgi b/editcomponents.cgi index 09acc0c51..8628f7762 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -191,7 +191,7 @@ if ($action eq 'new') { trick_taint($comp_name); trick_taint($description); - $dbh->bz_lock_tables('components WRITE', 'component_cc WRITE'); + $dbh->bz_start_transaction(); $dbh->do("INSERT INTO components (product_id, name, description, initialowner, @@ -209,7 +209,7 @@ if ($action eq 'new') { $sth->execute($user_id, $component->id); } - $dbh->bz_unlock_tables; + $dbh->bz_commit_transaction(); # Insert default charting queries for this product. # If they aren't using charting, this won't do any harm. @@ -301,8 +301,7 @@ if ($action eq 'delete') { } } - $dbh->bz_lock_tables('components WRITE', 'component_cc WRITE', - 'flaginclusions WRITE', 'flagexclusions WRITE'); + $dbh->bz_start_transaction(); $dbh->do("DELETE FROM flaginclusions WHERE component_id = ?", undef, $component->id); @@ -313,7 +312,7 @@ if ($action eq 'delete') { $dbh->do("DELETE FROM components WHERE id = ?", undef, $component->id); - $dbh->bz_unlock_tables(); + $dbh->bz_commit_transaction(); $vars->{'comp'} = $component; $vars->{'product'} = $product; @@ -402,8 +401,7 @@ if ($action eq 'update') { my $initial_cc_ids = check_initial_cc(\@initial_cc); - $dbh->bz_lock_tables('components WRITE', 'component_cc WRITE', - 'profiles READ'); + $dbh->bz_start_transaction(); if ($comp_name ne $component_old->name) { @@ -457,7 +455,7 @@ if ($action eq 'update') { $vars->{'updated_initialcc'} = 1; } - $dbh->bz_unlock_tables(); + $dbh->bz_commit_transaction(); my $component = new Bugzilla::Component($component_old->id); |