diff options
author | 2007-10-10 04:21:48 +0000 | |
---|---|---|
committer | 2007-10-10 04:21:48 +0000 | |
commit | 24a90239690d3c59538cb4044bc31411efd83464 (patch) | |
tree | 09242819613a0cd56319b09bf258077dce147d70 /editvalues.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 'editvalues.cgi')
-rwxr-xr-x | editvalues.cgi | 10 |
1 files changed, 4 insertions, 6 deletions
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. |