Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add commit and rollback retain and parsing params issue #7

Merged
merged 1 commit into from

2 participants

@pmakowski

please pull this
it add commit and rollback retain
and fix parsing params issue :
under Python3 :
in params_to_blr
if t == str or t == unicode:
NameError: global name 'unicode' is not defined

@nakagami nakagami merged commit eef1ab7 into nakagami:master
@nakagami
Owner
@pmakowski

you're welcome
I also added
ISOLATION_LEVEL_READ_COMMITED_READ_ONLY
bs([isc_tpb_version3, isc_tpb_read, isc_tpb_wait, isc_tpb_read_committed, isc_tpb_no_rec_version]),

see commit pmakowski@8c8f793
but I made a mistake in this commit the change in def params_to_blr(self, params): should not be done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 19, 2011
  1. add commit and rollback retain

    Philippe Makowski authored
This page is out of date. Refresh to see the latest.
Showing with 33 additions and 10 deletions.
  1. +33 −10 firebirdsql/fbcore.py
View
43 firebirdsql/fbcore.py
@@ -574,6 +574,8 @@ class BaseConnect:
op_detach = 21
op_transaction = 29
op_commit = 30
+ op_commit_retaining = 50
+ op_rollback_retaining = 86
op_rollback = 31
op_open_blob = 35
op_get_segment = 36
@@ -664,8 +666,8 @@ def params_to_blr(self, params):
values = bs([])
for p in params:
t = type(p)
-
- if t == str or t == unicode:
+ if ((PYTHON_MAJOR_VER==3 and t == str) or
+ (PYTHON_MAJOR_VER==2 and t == unicode)):
v = self.str_to_bytes(p)
nbytes = len(v)
pad_length = ((4-nbytes) & 3)
@@ -845,12 +847,25 @@ def _op_commit(self):
send_channel(self.sock, p.get_buffer())
@wire_operation
+ def _op_commit_retaining(self):
+ p = xdrlib.Packer()
+ p.pack_int(self.op_commit_retaining)
+ p.pack_int(self.trans_handle)
+ send_channel(self.sock, p.get_buffer())
+
+ @wire_operation
def _op_rollback(self):
p = xdrlib.Packer()
p.pack_int(self.op_rollback)
p.pack_int(self.trans_handle)
send_channel(self.sock, p.get_buffer())
+ @wire_operation
+ def _op_rollback_retaining(self):
+ p = xdrlib.Packer()
+ p.pack_int(self.op_rollback_retaining)
+ p.pack_int(self.trans_handle)
+ send_channel(self.sock, p.get_buffer())
@wire_operation
def _op_allocate_statement(self):
@@ -1055,15 +1070,23 @@ def begin(self):
(h, oid, buf) = self._op_response()
self.trans_handle = h
- def commit(self):
- self._op_commit()
- (h, oid, buf) = self._op_response()
- delattr(self, "trans_handle")
+ def commit(self, retaining=False):
+ if retaining:
+ self._op_commit_retaining()
+ (h, oid, buf) = self._op_response()
+ else:
+ self._op_commit()
+ (h, oid, buf) = self._op_response()
+ delattr(self, "trans_handle")
- def rollback(self):
- self._op_rollback()
- (h, oid, buf) = self._op_response()
- delattr(self, "trans_handle")
+ def rollback(self, retaining=False):
+ if retaining:
+ self._op_rollback_retaining()
+ (h, oid, buf) = self._op_response()
+ else:
+ self._op_rollback()
+ (h, oid, buf) = self._op_response()
+ delattr(self, "trans_handle")
def close(self):
if not hasattr(self, "db_handle"):
Something went wrong with that request. Please try again.