From d3f8bf365e5b93f58497a25e07fde7ce30884f9d Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Fri, 18 Feb 2005 05:57:26 +0000 Subject: Bug 280503: Replace "LOCK/UNLOCK TABLES" with Bugzilla::DB function call Patch By Tomas Kopal r=mkanat,a=myk --- editversions.cgi | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'editversions.cgi') 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; -- cgit v1.2.3-24-g4f1b