Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: Changeset: r44655:fbe2a578f96c Date: 2011-06-02 17:55 +0200 http://bitbucket.org/pypy/pypy/changeset/fbe2a578f96c/
Log: (nekto0n) cx_Oracle: add support for "twophase" connections diff --git a/pypy/module/oracle/interp_connect.py b/pypy/module/oracle/interp_connect.py --- a/pypy/module/oracle/interp_connect.py +++ b/pypy/module/oracle/interp_connect.py @@ -159,9 +159,20 @@ # set the internal and external names; these are needed for global # transactions but are limited in terms of the lengths of the strings if twophase: - raise OperationError( - interp_error.get(space).w_NotSupportedError, - space.wrap("XXX write me")) + status = roci.OCIAttrSet( + self.serverHandle, roci.OCI_HTYPE_SERVER, + "cx_Oracle", 0, + roci.OCI_ATTR_INTERNAL_NAME, + self.environment.errorHandle) + self.environment.checkForError( + status, "Connection_Connect(): set internal name") + status = roci.OCIAttrSet( + self.serverHandle, roci.OCI_HTYPE_SERVER, + "cx_Oracle", 0, + roci.OCI_ATTR_EXTERNAL_NAME, + self.environment.errorHandle) + self.environment.checkForError( + status, "Connection_Connect(): set external name") # allocate the session handle handleptr = lltype.malloc(rffi.CArrayPtr(roci.OCISession).TO, diff --git a/pypy/module/oracle/roci.py b/pypy/module/oracle/roci.py --- a/pypy/module/oracle/roci.py +++ b/pypy/module/oracle/roci.py @@ -73,7 +73,8 @@ defines = ''' OCI_ATTR_SERVER OCI_ATTR_SESSION OCI_ATTR_USERNAME OCI_ATTR_PASSWORD OCI_ATTR_STMT_TYPE OCI_ATTR_PARAM OCI_ATTR_PARAM_COUNT OCI_ATTR_ROW_COUNT - OCI_ATTR_NAME OCI_ATTR_SCALE OCI_ATTR_PRECISION OCI_ATTR_IS_NULL + OCI_ATTR_NAME OCI_ATTR_INTERNAL_NAME OCI_ATTR_EXTERNAL_NAME + OCI_ATTR_SCALE OCI_ATTR_PRECISION OCI_ATTR_IS_NULL OCI_ATTR_DATA_SIZE OCI_ATTR_DATA_TYPE OCI_ATTR_REF_TDO OCI_ATTR_SCHEMA_NAME OCI_ATTR_TYPE_NAME OCI_ATTR_TYPECODE OCI_ATTR_NUM_TYPE_ATTRS OCI_ATTR_LIST_TYPE_ATTRS diff --git a/pypy/module/oracle/test/test_connect.py b/pypy/module/oracle/test/test_connect.py --- a/pypy/module/oracle/test/test_connect.py +++ b/pypy/module/oracle/test/test_connect.py @@ -53,6 +53,13 @@ assert self.cnx.tnsentry == self.tnsentry assert isinstance(self.cnx.version, str) + def test_connect_twophase(self): + self.cnx = oracle.connect(self.username, self.password, + self.tnsentry, twophase=True) + assert self.cnx.username == self.username + assert self.cnx.password == self.password + assert self.cnx.tnsentry == self.tnsentry + def test_singleArg(self): self.cnx = oracle.connect("%s/%s@%s" % (self.username, self.password, self.tnsentry)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit