]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 285397: Untested parts of Bugzilla::DB are broken (when running on PostgreSQL)
authormkanat%kerio.com <>
Thu, 10 Mar 2005 15:59:48 +0000 (15:59 +0000)
committermkanat%kerio.com <>
Thu, 10 Mar 2005 15:59:48 +0000 (15:59 +0000)
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=Tomas.Kopal, a=justdave

Bugzilla/DB.pm
Bugzilla/DB/Mysql.pm
Bugzilla/DB/Pg.pm

index 59d19b48be73f0c46b9dae2b83fc150bae25808f..cf1e391f52d8b21c756c6ad7b0d36a528aa268c3 100644 (file)
@@ -478,12 +478,11 @@ sub bz_start_transaction {
     my ($self) = @_;
 
     if ($self->{private_bz_in_transaction}) {
-        carp("Can't start transaction within another transaction");
         ThrowCodeError("nested_transaction");
     } else {
         # Turn AutoCommit off and start a new transaction
         $self->begin_work();
-        $self->{privateprivate_bz_in_transaction} = 1;
+        $self->{private_bz_in_transaction} = 1;
     }
 }
 
@@ -491,7 +490,6 @@ sub bz_commit_transaction {
     my ($self) = @_;
 
     if (!$self->{private_bz_in_transaction}) {
-        carp("Can't commit without a transaction");
         ThrowCodeError("not_in_transaction");
     } else {
         $self->commit();
@@ -504,7 +502,6 @@ sub bz_rollback_transaction {
     my ($self) = @_;
 
     if (!$self->{private_bz_in_transaction}) {
-        carp("Can't rollback without a transaction");
         ThrowCodeError("not_in_transaction");
     } else {
         $self->rollback();
index 14230b1882cfc8f66f67ddd42a4074f58809bfe6..33354cb44f9d05d3bff130eb12d1944f96d58db3 100644 (file)
@@ -42,7 +42,6 @@ package Bugzilla::DB::Mysql;
 use strict;
 
 use Bugzilla::Error;
-use Carp;
 
 # This module extends the DB interface via inheritance
 use base qw(Bugzilla::DB);
@@ -149,7 +148,6 @@ sub bz_lock_tables {
 
     # Check first if there was no lock before
     if ($self->{private_bz_tables_locked}) {
-        carp("Tables already locked");
         ThrowCodeError("already_locked");
     } else {
         $self->do('LOCK TABLE ' . join(', ', @tables)); 
@@ -165,7 +163,6 @@ sub bz_unlock_tables {
     if (!$self->{private_bz_tables_locked}) {
         # Abort is allowed even without previous lock for error handling
         return if $abort;
-        carp("No matching lock");
         ThrowCodeError("no_matching_lock");
     } else {
         $self->do("UNLOCK TABLES");
index 2ec3000d546bd3e78bd94683d4ed34963de98a7e..de3260e7a4017ed15d33d52b98d2fbd68559463a 100644 (file)
@@ -42,7 +42,6 @@ package Bugzilla::DB::Pg;
 use strict;
 
 use Bugzilla::Error;
-use Carp;
 
 # This module extends the DB interface via inheritance
 use base qw(Bugzilla::DB);
@@ -146,7 +145,6 @@ sub bz_lock_tables {
    
     # Check first if there was no lock before
     if ($self->{private_bz_tables_locked}) {
-        carp("Tables already locked");
         ThrowCodeError("already_locked");
     } else {
         my %read_tables;
@@ -173,6 +171,7 @@ sub bz_lock_tables {
                           ' IN ROW SHARE MODE') if keys %read_tables;
         Bugzilla->dbh->do('LOCK TABLE ' . join(', ', keys %write_tables) .
                           ' IN ROW EXCLUSIVE MODE') if keys %write_tables;
+        $self->{private_bz_tables_locked} = 1;
     }
 }
 
@@ -183,10 +182,9 @@ sub bz_unlock_tables {
     if (!$self->{private_bz_tables_locked}) {
         # Abort is allowed even without previous lock for error handling
         return if $abort;
-
-        carp("No matching lock");
         ThrowCodeError("no_matching_lock");
     } else {
+        $self->{private_bz_tables_locked} = 0;
         # End transaction, tables will be unlocked automatically
         if ($abort) {
             $self->bz_rollback_transaction();