Added support for setting CLIENT_DRIVER in V$SESSION_CONNECT_INFO in Oracle 11g

and higher.
This commit is contained in:
Anthony Tuininga 2008-06-04 17:28:43 +00:00
parent 71d26018b7
commit b1c77b8456
3 changed files with 22 additions and 8 deletions

View File

@ -418,6 +418,17 @@ static int Connection_Connect(
return -1; return -1;
} }
#ifdef OCI_ATTR_DRIVER_NAME
printf("setting driver name to %s\n", DRIVER_NAME);
status = OCIAttrSet(self->sessionHandle, OCI_HTYPE_SESSION,
(text*) DRIVER_NAME, strlen(DRIVER_NAME), OCI_ATTR_DRIVER_NAME,
self->environment->errorHandle);
if (Environment_CheckForError(self->environment, status,
"Connection_Connect(): set driver name") < 0)
return -1;
#endif
// set the session handle on the service context handle // set the session handle on the service context handle
status = OCIAttrSet(self->handle, OCI_HTYPE_SVCCTX, status = OCIAttrSet(self->handle, OCI_HTYPE_SVCCTX,
self->sessionHandle, 0, OCI_ATTR_SESSION, self->sessionHandle, 0, OCI_ATTR_SESSION,

View File

@ -16,24 +16,26 @@ Changes from 4.3.3 to 4.4
during the rollback; unfortunately, Oracle decides to commit data even when during the rollback; unfortunately, Oracle decides to commit data even when
dropping a connection from the pool instead of rolling it back so the dropping a connection from the pool instead of rolling it back so the
attempt still has to be made. attempt still has to be made.
7) Use cx_Oracle.InterfaceError rather than the builtin RuntimeError when 7) Added support for setting CLIENT_DRIVER in V$SESSION_CONNECT_INFO in Oracle
11g and higher.
8) Use cx_Oracle.InterfaceError rather than the builtin RuntimeError when
unable to create the Oracle environment object as requested by Luke Mewburn unable to create the Oracle environment object as requested by Luke Mewburn
since the error is specific to Oracle and someone attempting to catch any since the error is specific to Oracle and someone attempting to catch any
exception cannot simply use cx_Oracle.Error. exception cannot simply use cx_Oracle.Error.
8) Translated some error codes to OperationalError as requested by Matthew 9) Translated some error codes to OperationalError as requested by Matthew
Harriger; translated if/elseif/else logic to switch statement to make it Harriger; translated if/elseif/else logic to switch statement to make it
more readable and to allow for additional translation if desired. more readable and to allow for additional translation if desired.
9) Transformed documentation to new format using restructured text. Thanks to 10) Transformed documentation to new format using restructured text. Thanks to
Waldemar Osuch for contributing the initial draft of the new documentation. Waldemar Osuch for contributing the initial draft of the new documentation.
10) Allow the password to be overwritten by a new value as requested by Alex 11) Allow the password to be overwritten by a new value as requested by Alex
VanderWoude; this value is retained as a convenience to the user and not VanderWoude; this value is retained as a convenience to the user and not
used by anything in the module; if changed externally it may be convenient used by anything in the module; if changed externally it may be convenient
to keep this copy up to date. to keep this copy up to date.
11) Cygwin is on Windows so should be treated in the same way as noted by 12) Cygwin is on Windows so should be treated in the same way as noted by
Matthew Cahn. Matthew Cahn.
12) Add support for using setuptools if so desired as requested by Shreya 13) Add support for using setuptools if so desired as requested by Shreya
Bhatt. Bhatt.
13) Specify that the version of Oracle 10 that is now primarily used is 10.2, 14) Specify that the version of Oracle 10 that is now primarily used is 10.2,
not 10.1. not 10.1.
Changes from 4.3.2 to 4.3.3 Changes from 4.3.2 to 4.3.3

View File

@ -50,10 +50,11 @@ typedef int Py_ssize_t;
if (PyModule_AddObject(module, name, (PyObject*) type) < 0) \ if (PyModule_AddObject(module, name, (PyObject*) type) < 0) \
return; return;
// define macro to get the build version as a string // define macros to get the build version as a string and the driver name
#define xstr(s) str(s) #define xstr(s) str(s)
#define str(s) #s #define str(s) #s
#define BUILD_VERSION_STRING xstr(BUILD_VERSION) #define BUILD_VERSION_STRING xstr(BUILD_VERSION)
#define DRIVER_NAME "cx_Oracle-"BUILD_VERSION_STRING
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------