Bug 398976: edit*.cgi scripts should use transactions for database interaction - Patch by Emmanuel Seyman <eseyman@linagora.com> r/a=mkanat

git-svn-id: svn://10.0.0.236/trunk@237494 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
lpsolit%gmail.com
2007-10-09 23:21:49 +00:00
parent ad23a889c5
commit 55fed2d7ff
7 changed files with 36 additions and 97 deletions

View File

@@ -172,7 +172,7 @@ if ($action eq 'delete') {
}
# lock the tables before we start to change everything:
$dbh->bz_lock_tables('classifications WRITE', 'products WRITE');
$dbh->bz_start_transaction();
# delete
$dbh->do("DELETE FROM classifications WHERE id = ?", undef,
@@ -182,7 +182,7 @@ if ($action eq 'delete') {
$dbh->do("UPDATE products SET classification_id = 1
WHERE classification_id = ?", undef, $classification->id);
$dbh->bz_unlock_tables();
$dbh->bz_commit_transaction();
$vars->{'classification'} = $classification;
@@ -229,7 +229,7 @@ if ($action eq 'update') {
|| ThrowUserError('classification_invalid_sortkey', {'name' => $class_old->name,
'sortkey' => $stored_sortkey});
$dbh->bz_lock_tables('classifications WRITE');
$dbh->bz_start_transaction();
if ($class_name ne $class_old->name) {
@@ -262,7 +262,7 @@ if ($action eq 'update') {
$vars->{'updated_sortkey'} = 1;
}
$dbh->bz_unlock_tables();
$dbh->bz_commit_transaction();
delete_token($token);
LoadTemplate($action);