summaryrefslogtreecommitdiffstats
path: root/editcomponents.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-10-10 06:21:48 +0200
committerlpsolit%gmail.com <>2007-10-10 06:21:48 +0200
commit24a90239690d3c59538cb4044bc31411efd83464 (patch)
tree09242819613a0cd56319b09bf258077dce147d70 /editcomponents.cgi
parenta81a0804496d263f9de71b03e2ebf612e3c534cc (diff)
downloadbugzilla-24a90239690d3c59538cb4044bc31411efd83464.tar.gz
bugzilla-24a90239690d3c59538cb4044bc31411efd83464.tar.xz
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-xeditcomponents.cgi14
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);