From 230976efc0233c7157f6b6a3919e5eb885dbe4a7 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 8 Jul 2005 04:15:20 +0000 Subject: =?UTF-8?q?Bug=20299212:=20"already=20locked"=20errors=20should=20?= =?UTF-8?q?be=20more=20informative=20-=20Patch=20by=20Fr=C3=A9d=C3=A9ric?= =?UTF-8?q?=20Buclin=20=20r=3Dglob=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/DB/Pg.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Bugzilla/DB/Pg.pm') diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index a83b75bd9..97473e564 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -70,7 +70,7 @@ sub new { # all class local variables stored in DBI derived class needs to have # a prefix 'private_'. See DBI documentation. - $self->{private_bz_tables_locked} = 0; + $self->{private_bz_tables_locked} = ""; bless ($self, $class); @@ -147,9 +147,11 @@ sub sql_string_concat { sub bz_lock_tables { my ($self, @tables) = @_; + my $list = join(', ', @tables); # Check first if there was no lock before if ($self->{private_bz_tables_locked}) { - ThrowCodeError("already_locked"); + ThrowCodeError("already_locked", { current => $self->{private_bz_tables_locked}, + new => $list }); } else { my %read_tables; my %write_tables; @@ -175,7 +177,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; + $self->{private_bz_tables_locked} = $list; } } @@ -188,7 +190,7 @@ sub bz_unlock_tables { return if $abort; ThrowCodeError("no_matching_lock"); } else { - $self->{private_bz_tables_locked} = 0; + $self->{private_bz_tables_locked} = ""; # End transaction, tables will be unlocked automatically if ($abort) { $self->bz_rollback_transaction(); -- cgit v1.2.1