From 24a90239690d3c59538cb4044bc31411efd83464 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 10 Oct 2007 04:21:48 +0000 Subject: Bug 398976: edit*.cgi scripts should use transactions for database interaction - Patch by Emmanuel Seyman r/a=mkanat --- editcomponents.cgi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'editcomponents.cgi') 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); -- cgit v1.2.3-24-g4f1b