Author: spadkins
Date: Wed Jul 18 11:18:52 2007
New Revision: 9762
Modified:
p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm
Log:
changed begin_work(), commit(), rollback() to consult an {in_transaction}
attribute
Modified: p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm Wed Jul 18 11:18:52 2007
@@ -200,6 +200,7 @@
}
die "Can't connect to database" if (!$self->{dbh});
}
+ delete $self->{in_transaction};
&App::sub_exit(defined $self->{dbh}) if ($App::trace);
return(defined $self->{dbh});
@@ -2487,7 +2488,10 @@
sub begin_work {
&App::sub_entry if ($App::trace);
my $self = shift;
- $self->{dbh}->begin_work();
+ if (!$self->{in_transaction}) {
+ $self->{dbh}->begin_work();
+ $self->{in_transaction} = 1;
+ }
&App::sub_exit() if ($App::trace);
}
@@ -2512,7 +2516,10 @@
sub commit {
&App::sub_entry if ($App::trace);
my $self = shift;
- $self->{dbh}->commit();
+ if ($self->{in_transaction}) {
+ $self->{dbh}->commit();
+ delete $self->{in_transaction};
+ }
&App::sub_exit() if ($App::trace);
}
@@ -2537,7 +2544,10 @@
sub rollback {
&App::sub_entry if ($App::trace);
my $self = shift;
- $self->{dbh}->rollback();
+ if ($self->{in_transaction}) {
+ $self->{dbh}->rollback();
+ delete $self->{in_transaction};
+ }
&App::sub_exit() if ($App::trace);
}