summaryrefslogtreecommitdiffstats
path: root/attachment.cgi
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-02-18 06:57:26 +0100
committermkanat%kerio.com <>2005-02-18 06:57:26 +0100
commitd3f8bf365e5b93f58497a25e07fde7ce30884f9d (patch)
treeba45ba2aa22039ecd440ca4c5c7fa421eb158456 /attachment.cgi
parentf95d1faba79c94bcf3bf936334d6bb10e03c93b2 (diff)
downloadbugzilla-d3f8bf365e5b93f58497a25e07fde7ce30884f9d.tar.gz
bugzilla-d3f8bf365e5b93f58497a25e07fde7ce30884f9d.tar.xz
Bug 280503: Replace "LOCK/UNLOCK TABLES" with Bugzilla::DB function call
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat,a=myk
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-xattachment.cgi21
1 files changed, 11 insertions, 10 deletions
diff --git a/attachment.cgi b/attachment.cgi
index d58395efc..5e10d8fee 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -1051,15 +1051,16 @@ sub edit
sub update
{
# Updates an attachment record.
+ my $dbh = Bugzilla->dbh;
# Get the bug ID for the bug to which this attachment is attached.
SendSQL("SELECT bug_id FROM attachments WHERE attach_id = $::FORM{'id'}");
my $bugid = FetchSQLData();
-
+
# Lock database tables in preparation for updating the attachment.
- SendSQL("LOCK TABLES attachments WRITE , flags WRITE , " .
- "flagtypes READ , fielddefs READ , bugs_activity WRITE, " .
- "flaginclusions AS i READ, flagexclusions AS e READ, " .
+ $dbh->bz_lock_tables('attachments WRITE', 'flags WRITE' ,
+ 'flagtypes READ', 'fielddefs READ', 'bugs_activity WRITE',
+ 'flaginclusions AS i READ', 'flagexclusions AS e READ',
# cc, bug_group_map, user_group_map, and groups are in here so we
# can check the permissions of flag requestees and email addresses
# on the flag type cc: lists via the CanSeeBug
@@ -1067,10 +1068,10 @@ sub update
# Bugzilla::User needs to rederive groups. profiles and
# user_group_map would be READ locks instead of WRITE locks if it
# weren't for derive_groups, which needs to write to those tables.
- "bugs READ, profiles WRITE, " .
- "cc READ, bug_group_map READ, user_group_map WRITE, " .
- "group_group_map READ, groups READ");
-
+ 'bugs READ', 'profiles WRITE',
+ 'cc READ', 'bug_group_map READ', 'user_group_map WRITE',
+ 'group_group_map READ', 'groups READ');
+
# Get a copy of the attachment record before we make changes
# so we can record those changes in the activity table.
SendSQL("SELECT description, mimetype, filename, ispatch, isobsolete, isprivate
@@ -1138,9 +1139,9 @@ sub update
# Update flags.
my $target = Bugzilla::Flag::GetTarget(undef, $::FORM{'id'});
Bugzilla::Flag::process($target, $timestamp, \%::FORM);
-
+
# Unlock all database tables now that we are finished updating the database.
- SendSQL("UNLOCK TABLES");
+ $dbh->bz_unlock_tables();
# If the user submitted a comment while editing the attachment,
# add the comment to the bug.