Added support for determining the version of the client library being used,

available in Oracle 10g Release 2 and higher.
This commit is contained in:
Anthony Tuininga 2007-09-30 04:51:44 +00:00
parent 3eb4d33c54
commit 8c93273f5e
2 changed files with 31 additions and 0 deletions

View File

@ -147,6 +147,25 @@ static PyObject* MakeDSN(
}
#ifdef ORACLE_10GR2
//-----------------------------------------------------------------------------
// ClientVersion()
// Return the version of the Oracle client being used as a 5-tuple.
//-----------------------------------------------------------------------------
static PyObject* ClientVersion(
PyObject* self, // passthrough argument
PyObject* args) // arguments to function
{
sword majorVersion, minorVersion, updateNum, patchNum, portUpdateNum;
OCIClientVersion(&majorVersion, &minorVersion, &updateNum,
&patchNum, &portUpdateNum);
return Py_BuildValue("(iiiii)", majorVersion, minorVersion, updateNum,
patchNum, portUpdateNum);
}
#endif
//-----------------------------------------------------------------------------
// Time()
// Returns a time value suitable for binding.
@ -258,6 +277,9 @@ static PyMethodDef g_ModuleMethods[] = {
{ "DateFromTicks", DateFromTicks, METH_VARARGS },
{ "TimeFromTicks", TimeFromTicks, METH_VARARGS },
{ "TimestampFromTicks", TimestampFromTicks, METH_VARARGS },
#ifdef ORACLE_10GR2
{ "clientversion", ClientVersion, METH_NOARGS },
#endif
{ NULL }
};

View File

@ -46,6 +46,15 @@ information on the Python database API specification.
Construct an object holding a binary (long) string value.
\end{funcdesc}
\begin{funcdesc}{clientversion}{}
Return the version of the client library being used as a 5 tuple. The five
values are the major version, minor version, update number, patch number
and port update number.
\strong{NOTE:} This method is an extension to the DB API definition and is
only available in Oracle 10g Release 2 and higher.
\end{funcdesc}
\begin{funcdesc}{Connection}{\optional{\var{user}, \var{password},
\var{dsn}, \var{mode}, \var{handle}, \var{pool}, \var{threaded},
\var{twophase}}}