[open-ils-commits] r11973 - trunk/Open-ILS/src/perlmods/OpenILS/Utils
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 26 12:20:42 EST 2009
Author: erickson
Date: 2009-01-26 12:20:39 -0500 (Mon, 26 Jan 2009)
New Revision: 11973
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
Log:
added savepoint support
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm 2009-01-26 17:10:10 UTC (rev 11972)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm 2009-01-26 17:20:39 UTC (rev 11973)
@@ -233,7 +233,42 @@
}
+# -----------------------------------------------------------------------------
+# Savepoint functions. If no savepoint name is provided, the same name is used
+# for each successive savepoint, in which case only the last savepoint set can
+# be released or rolled back.
+# -----------------------------------------------------------------------------
+sub set_savepoint {
+ my $self = shift;
+ my $name = shift || 'savepoint';
+ return unless $self->{session} and $self->{xact_id};
+ $self->log(I, "setting savepoint '$name'");
+ my $stat = $self->request($self->app.".savepoint.set")
+ or $self->log(E, "error setting savepoint '$name'");
+ return $stat;
+}
+sub release_savepoint {
+ my $self = shift;
+ my $name = shift || 'savepoint';
+ return unless $self->{session} and $self->{xact_id};
+ $self->log(I, "releasing savepoint '$name'");
+ my $stat = $self->request($self->app.".savepoint.release")
+ or $self->log(E, "error releasing savepoint '$name'");
+ return $stat;
+}
+
+sub rollback_savepoint {
+ my $self = shift;
+ my $name = shift || 'savepoint';
+ return unless $self->{session} and $self->{xact_id};
+ $self->log(I, "rollback savepoint '$name'");
+ my $stat = $self->request($self->app.".savepoint.rollback")
+ or $self->log(E, "error rolling back savepoint '$name'");
+ return $stat;
+}
+
+
# -----------------------------------------------------------------------------
# Rolls back the transaction and disconnects
# -----------------------------------------------------------------------------
More information about the open-ils-commits
mailing list