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;
}
}
my ($self) = @_;
if (!$self->{private_bz_in_transaction}) {
- carp("Can't commit without a transaction");
ThrowCodeError("not_in_transaction");
} else {
$self->commit();
my ($self) = @_;
if (!$self->{private_bz_in_transaction}) {
- carp("Can't rollback without a transaction");
ThrowCodeError("not_in_transaction");
} else {
$self->rollback();
use strict;
use Bugzilla::Error;
-use Carp;
# This module extends the DB interface via inheritance
use base qw(Bugzilla::DB);
# 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));
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");
use strict;
use Bugzilla::Error;
-use Carp;
# This module extends the DB interface via inheritance
use base qw(Bugzilla::DB);
# 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;
' 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;
}
}
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();