aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-02-18 05:57:26 +0000
committermkanat%kerio.com <>2005-02-18 05:57:26 +0000
commitd3f8bf365e5b93f58497a25e07fde7ce30884f9d (patch)
treeba45ba2aa22039ecd440ca4c5c7fa421eb158456 /editversions.cgi
parentBug 280093 : Update "Add to Sidbar" HTML text and JS addsidebar() function (diff)
downloadbugzilla-d3f8bf365e5b93f58497a25e07fde7ce30884f9d.tar.gz
bugzilla-d3f8bf365e5b93f58497a25e07fde7ce30884f9d.tar.bz2
bugzilla-d3f8bf365e5b93f58497a25e07fde7ce30884f9d.zip
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 'editversions.cgi')
-rwxr-xr-xeditversions.cgi25
1 files changed, 13 insertions, 12 deletions
diff --git a/editversions.cgi b/editversions.cgi
index 222e7dd8e..ee4a83d77 100755
--- a/editversions.cgi
+++ b/editversions.cgi
@@ -39,6 +39,7 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
use vars qw($template $vars);
my $cgi = Bugzilla->cgi;
+my $dbh = Bugzilla->dbh;
# TestProduct: just returns if the specified product does exists
# CheckProduct: same check, optionally emit an error text
@@ -303,11 +304,11 @@ if ($action eq 'delete') {
# lock the tables before we start to change everything:
- SendSQL("LOCK TABLES attachments WRITE,
- bugs WRITE,
- bugs_activity WRITE,
- versions WRITE,
- dependencies WRITE");
+ $dbh->bz_lock_tables('attachments WRITE',
+ 'bugs WRITE',
+ 'bugs_activity WRITE',
+ 'versions WRITE',
+ 'dependencies WRITE');
# According to MySQL doc I cannot do a DELETE x.* FROM x JOIN Y,
# so I have to iterate over bugs and delete all the indivial entries
@@ -347,7 +348,7 @@ if ($action eq 'delete') {
WHERE product_id = $product_id
AND value = " . SqlQuote($version));
- SendSQL("UNLOCK TABLES;");
+ $dbh->bz_unlock_tables();
unlink "$datadir/versioncache";
@@ -399,18 +400,18 @@ if ($action eq 'update') {
# Note that the order of this tests is important. If you change
# them, be sure to test for WHERE='$version' or WHERE='$versionold'
- SendSQL("LOCK TABLES bugs WRITE,
- versions WRITE,
- products READ");
+ $dbh->bz_lock_tables('bugs WRITE',
+ 'versions WRITE',
+ 'products READ');
if ($version ne $versionold) {
unless ($version) {
- SendSQL('UNLOCK TABLES');
+ $dbh->bz_unlock_tables(UNLOCK_ABORT);
ThrowUserError('version_blank_name');
exit;
}
if (TestVersion($product,$version)) {
- SendSQL('UNLOCK TABLES');
+ $dbh->bz_unlock_tables(UNLOCK_ABORT);
ThrowUserError('version_already_exists',
{'name' => $version,
'product' => $product});
@@ -430,7 +431,7 @@ if ($action eq 'update') {
$vars->{'updated_name'} = 1;
}
- SendSQL('UNLOCK TABLES');
+ $dbh->bz_unlock_tables();
$vars->{'name'} = $version;
$vars->{'product'} = $product;