Skip to content

Commit

Permalink
Added mode cx_Oracle.DEFAULT_AUTH as requested
Browse files Browse the repository at this point in the history
(#293) and adjusted
documentation for other cases that specified None where None is not actually
a valid value.
  • Loading branch information
anthony-tuininga committed Apr 29, 2019
1 parent 8209789 commit 04a7dec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
33 changes: 19 additions & 14 deletions doc/src/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ Module Interface
This method is an extension to the DB API definition.


.. function:: Connection(user=None, password=None, dsn=None, mode=None, \
handle=None, pool=None, threaded=False, events=False, cclass=None, \
purity=None, newpassword=None, encoding=None, nencoding=None, \
edition=None, appcontext=[], tag=None, matchanytag=False, \
shardingkey=[], supershardingkey=[])
connect(user=None, password=None, dsn=None, mode=None, handle=None, \
pool=None, threaded=False, events=False, cclass=None, purity=None, \
.. function:: Connection(user=None, password=None, dsn=None, \
mode=cx_Oracle.DEFAULT_AUTH, handle=0, pool=None, threaded=False, \
events=False, cclass=None, purity=cx_Oracle.ATTR_PURITY_DEFAULT, \
newpassword=None, encoding=None, nencoding=None, edition=None, \
appcontext=[], tag=None, matchanytag=None, shardingkey=[], \
appcontext=[], tag=None, matchanytag=False, shardingkey=[], \
supershardingkey=[])
connect(user=None, password=None, dsn=None, mode=cx_Oracle.DEFAULT_AUTH, \
handle=0, pool=None, threaded=False, events=False, cclass=None, \
purity=cx_Oracle.ATTR_PURITY_DEFAULT, newpassword=None, \
encoding=None, nencoding=None, edition=None, appcontext=[], tag=None, \
matchanytag=None, shardingkey=[], supershardingkey=[])

Constructor for creating a connection to the database. Return a
:ref:`connection object <connobj>`. All parameters are optional and can be
Expand All @@ -57,12 +58,9 @@ Module Interface
string is assumed which is to be of the format ``user/password@dsn``, the
same format accepted by Oracle applications such as SQL\*Plus.

If the mode is specified, it must be one of :data:`~cx_Oracle.SYSDBA`,
:data:`~cx_Oracle.SYSASM`, :data:`~cx_Oracle.SYSOPER`,
:data:`~cx_Oracle.SYSBKP`, :data:`~cx_Oracle.SYSDGD`,
:data:`~cx_Oracle.SYSKMT` or :data:`~cx_Oracle.SYSRAC` which are defined
at the module level; otherwise, it defaults to the normal mode of
connecting.
If the mode is specified, it must be one of the
:ref:`connection authorization modes<connection-authorization-modes>`
which are defined at the module level.

If the handle is specified, it must be of type OCISvcCtx\* and is only of
use when embedding Python in an application (like PowerBuilder) which has
Expand Down Expand Up @@ -584,13 +582,20 @@ constants used in advanced queuing.
default value.


.. _connection-authorization-modes:

Connection Authorization Modes
------------------------------

These constants are extensions to the DB API definition. They are possible
values for the mode parameter of the :meth:`connect()` method.


.. data:: DEFAULT_AUTH

This constant is used to specify that default authentication is to take
place. This is the default value if no mode is passed at all.

.. data:: PRELIM_AUTH

This constant is used to specify that preliminary authentication is to be
Expand Down
1 change: 1 addition & 0 deletions src/cxoModule.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ static PyObject *cxoModule_initialize(void)
return NULL;

// add constants for authorization modes
CXO_ADD_INT_CONSTANT("DEFAULT_AUTH", DPI_MODE_AUTH_DEFAULT)
CXO_ADD_INT_CONSTANT("SYSASM", DPI_MODE_AUTH_SYSASM)
CXO_ADD_INT_CONSTANT("SYSBKP", DPI_MODE_AUTH_SYSBKP)
CXO_ADD_INT_CONSTANT("SYSDBA", DPI_MODE_AUTH_SYSDBA)
Expand Down

0 comments on commit 04a7dec

Please sign in to comment.