summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-03-15 10:29:45 +0100
committermkanat%bugzilla.org <>2007-03-15 10:29:45 +0100
commit496ad3d1ff432cd04ee3a1a6c90d38e61450d606 (patch)
treeebc6ab41906ff0404b631ca09b0d4323219f1eda /Bugzilla/DB
parentedd47c05d21853caa46e9f95ca7e1504f215216f (diff)
downloadbugzilla-496ad3d1ff432cd04ee3a1a6c90d38e61450d606.tar.gz
bugzilla-496ad3d1ff432cd04ee3a1a6c90d38e61450d606.tar.xz
Bug 374004: Enable transaction code and use it in some installation places
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Mysql.pm29
1 files changed, 10 insertions, 19 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm
index 582a2a7b8..582df3d54 100644
--- a/Bugzilla/DB/Mysql.pm
+++ b/Bugzilla/DB/Mysql.pm
@@ -207,14 +207,23 @@ sub bz_lock_tables {
ThrowCodeError("already_locked", { current => $self->{private_bz_tables_locked},
new => $list });
} else {
+ $self->bz_start_transaction();
$self->do('LOCK TABLE ' . $list);
-
$self->{private_bz_tables_locked} = $list;
}
}
sub bz_unlock_tables {
my ($self, $abort) = @_;
+
+ if ($self->bz_in_transaction) {
+ if ($abort) {
+ $self->bz_rollback_transaction();
+ }
+ else {
+ $self->bz_commit_transaction();
+ }
+ }
# Check first if there was previous matching lock
if (!$self->{private_bz_tables_locked}) {
@@ -223,28 +232,10 @@ sub bz_unlock_tables {
ThrowCodeError("no_matching_lock");
} else {
$self->do("UNLOCK TABLES");
-
$self->{private_bz_tables_locked} = "";
}
}
-# As Bugzilla currently runs on MyISAM storage, which does not support
-# transactions, these functions die when called.
-# Maybe we should just ignore these calls for now, but as we are not
-# using transactions in MySQL yet, this just hints the developers.
-sub bz_start_transaction {
- die("Attempt to start transaction on DB without transaction support");
-}
-
-sub bz_commit_transaction {
- die("Attempt to commit transaction on DB without transaction support");
-}
-
-sub bz_rollback_transaction {
- die("Attempt to rollback transaction on DB without transaction support");
-}
-
-
sub _bz_get_initial_schema {
my ($self) = @_;
return $self->_bz_build_schema_from_disk();