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 --- editvalues.cgi | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'editvalues.cgi') diff --git a/editvalues.cgi b/editvalues.cgi index a9d5878c0..520c0797b 100755 --- a/editvalues.cgi +++ b/editvalues.cgi @@ -312,9 +312,7 @@ if ($action eq 'delete') { trick_taint($value); - my @lock_tables = ('bugs READ', "$field WRITE"); - push(@lock_tables, 'status_workflow WRITE') if ($field eq 'bug_status'); - $dbh->bz_lock_tables(@lock_tables); + $dbh->bz_start_transaction(); # Check if there are any bugs that still have this value. my $bug_ids = $dbh->selectcol_arrayref( @@ -338,7 +336,7 @@ if ($action eq 'delete') { $dbh->do("DELETE FROM $field WHERE value = ?", undef, $value); - $dbh->bz_unlock_tables(); + $dbh->bz_commit_transaction(); delete_token($token); $template->process("admin/fieldvalues/deleted.html.tmpl", @@ -396,7 +394,7 @@ if ($action eq 'update') { ThrowUserError('fieldvalue_name_too_long', $vars); } - $dbh->bz_lock_tables('bugs WRITE', "$field WRITE"); + $dbh->bz_start_transaction(); # Need to store because detaint_natural() will delete this if # invalid @@ -442,7 +440,7 @@ if ($action eq 'update') { $vars->{'updated_value'} = 1; } - $dbh->bz_unlock_tables(); + $dbh->bz_commit_transaction(); # If the old value was the default value for the field, # update data/params accordingly. -- cgit v1.2.3-24-g4f1b