
    h4                       d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ dZ G d dej4                        Z G d dej8                        Z G d dej<                        Z G d de      Z  G d de ejB                        Z" G d de ejF                        Z$ G d d e      Z% G d! d"ejL                        Z' G d# d$eejP                        Z) G d% d&      Z* G d' d(ejV                        Z, G d) d*ejZ                        Z. G d+ d,ej^                        Z0 G d- d.ejb                        Z2 G d/ d0e*ejf                        Z4 G d1 d2e*ejj                        Z6 G d3 d4e*ejn                        Z8 G d5 d6e*ejr                        Z: G d7 d8ejv                        Z< G d9 d:ejz                        Z> G d; d<e*ej~                        Z@ G d= d>ej                        ZB G d? d@ej                        ZD G dA dBej                        ZF G dC dDe	      ZG G dE dFe      ZH G dG dHe
      ZIeIZJy)IuTJ  .. dialect:: oracle+cx_oracle
    :name: cx-Oracle
    :dbapi: cx_oracle
    :connectstring: oracle+cx_oracle://user:pass@hostname:port[/dbname][?service_name=<service>[&key=value&key=value...]]
    :url: https://oracle.github.io/python-cx_Oracle/

Description
-----------

cx_Oracle was the original driver for Oracle Database. It was superseded by
python-oracledb which should be used instead.

DSN vs. Hostname connections
-----------------------------

cx_Oracle provides several methods of indicating the target database.  The
dialect translates from a series of different URL forms.

Hostname Connections with Easy Connect Syntax
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Given a hostname, port and service name of the target database, for example
from Oracle Database's Easy Connect syntax then connect in SQLAlchemy using the
``service_name`` query string parameter::

    engine = create_engine(
        "oracle+cx_oracle://scott:tiger@hostname:port?service_name=myservice&encoding=UTF-8&nencoding=UTF-8"
    )

Note that the default driver value for encoding and nencoding was changed to
“UTF-8” in cx_Oracle 8.0 so these parameters can be omitted when using that
version, or later.

To use a full Easy Connect string, pass it as the ``dsn`` key value in a
:paramref:`_sa.create_engine.connect_args` dictionary::

    import cx_Oracle

    e = create_engine(
        "oracle+cx_oracle://@",
        connect_args={
            "user": "scott",
            "password": "tiger",
            "dsn": "hostname:port/myservice?transport_connect_timeout=30&expire_time=60",
        },
    )

Connections with tnsnames.ora or to Oracle Autonomous Database
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Alternatively, if no port, database name, or service name is provided, the
dialect will use an Oracle Database DSN "connection string".  This takes the
"hostname" portion of the URL as the data source name.  For example, if the
``tnsnames.ora`` file contains a TNS Alias of ``myalias`` as below:

.. sourcecode:: text

    myalias =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = mymachine.example.com)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orclpdb1)
        )
      )

The cx_Oracle dialect connects to this database service when ``myalias`` is the
hostname portion of the URL, without specifying a port, database name or
``service_name``::

    engine = create_engine("oracle+cx_oracle://scott:tiger@myalias")

Users of Oracle Autonomous Database should use this syntax. If the database is
configured for mutural TLS ("mTLS"), then you must also configure the cloud
wallet as shown in cx_Oracle documentation `Connecting to Autononmous Databases
<https://cx-oracle.readthedocs.io/en/latest/user_guide/connection_handling.html#autonomousdb>`_.

SID Connections
^^^^^^^^^^^^^^^

To use Oracle Database's obsolete System Identifier connection syntax, the SID
can be passed in a "database name" portion of the URL::

    engine = create_engine(
        "oracle+cx_oracle://scott:tiger@hostname:port/dbname"
    )

Above, the DSN passed to cx_Oracle is created by ``cx_Oracle.makedsn()`` as
follows::

    >>> import cx_Oracle
    >>> cx_Oracle.makedsn("hostname", 1521, sid="dbname")
    '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521))(CONNECT_DATA=(SID=dbname)))'

Note that although the SQLAlchemy syntax ``hostname:port/dbname`` looks like
Oracle's Easy Connect syntax it is different. It uses a SID in place of the
service name required by Easy Connect.  The Easy Connect syntax does not
support SIDs.

Passing cx_Oracle connect arguments
-----------------------------------

Additional connection arguments can usually be passed via the URL query string;
particular symbols like ``SYSDBA`` are intercepted and converted to the correct
symbol::

    e = create_engine(
        "oracle+cx_oracle://user:pass@dsn?encoding=UTF-8&nencoding=UTF-8&mode=SYSDBA&events=true"
    )

.. versionchanged:: 1.3 the cx_Oracle dialect now accepts all argument names
   within the URL string itself, to be passed to the cx_Oracle DBAPI.   As
   was the case earlier but not correctly documented, the
   :paramref:`_sa.create_engine.connect_args` parameter also accepts all
   cx_Oracle DBAPI connect arguments.

To pass arguments directly to ``.connect()`` without using the query
string, use the :paramref:`_sa.create_engine.connect_args` dictionary.
Any cx_Oracle parameter value and/or constant may be passed, such as::

    import cx_Oracle

    e = create_engine(
        "oracle+cx_oracle://user:pass@dsn",
        connect_args={
            "encoding": "UTF-8",
            "nencoding": "UTF-8",
            "mode": cx_Oracle.SYSDBA,
            "events": True,
        },
    )

Note that the default driver value for ``encoding`` and ``nencoding`` was
changed to "UTF-8" in cx_Oracle 8.0 so these parameters can be omitted when
using that version, or later.

Options consumed by the SQLAlchemy cx_Oracle dialect outside of the driver
--------------------------------------------------------------------------

There are also options that are consumed by the SQLAlchemy cx_oracle dialect
itself.  These options are always passed directly to :func:`_sa.create_engine`
, such as::

    e = create_engine(
        "oracle+cx_oracle://user:pass@dsn", coerce_to_decimal=False
    )

The parameters accepted by the cx_oracle dialect are as follows:

* ``arraysize`` - set the cx_oracle.arraysize value on cursors; defaults
  to ``None``, indicating that the driver default should be used (typically
  the value is 100).  This setting controls how many rows are buffered when
  fetching rows, and can have a significant effect on performance when
  modified.

  .. versionchanged:: 2.0.26 - changed the default value from 50 to None,
    to use the default value of the driver itself.

* ``auto_convert_lobs`` - defaults to True; See :ref:`cx_oracle_lob`.

* ``coerce_to_decimal`` - see :ref:`cx_oracle_numeric` for detail.

* ``encoding_errors`` - see :ref:`cx_oracle_unicode_encoding_errors` for detail.

.. _cx_oracle_sessionpool:

Using cx_Oracle SessionPool
---------------------------

The cx_Oracle driver provides its own connection pool implementation that may
be used in place of SQLAlchemy's pooling functionality. The driver pool
supports Oracle Database features such dead connection detection, connection
draining for planned database downtime, support for Oracle Application
Continuity and Transparent Application Continuity, and gives support for
Database Resident Connection Pooling (DRCP).

Using the driver pool can be achieved by using the
:paramref:`_sa.create_engine.creator` parameter to provide a function that
returns a new connection, along with setting
:paramref:`_sa.create_engine.pool_class` to ``NullPool`` to disable
SQLAlchemy's pooling::

    import cx_Oracle
    from sqlalchemy import create_engine
    from sqlalchemy.pool import NullPool

    pool = cx_Oracle.SessionPool(
        user="scott",
        password="tiger",
        dsn="orclpdb",
        min=1,
        max=4,
        increment=1,
        threaded=True,
        encoding="UTF-8",
        nencoding="UTF-8",
    )

    engine = create_engine(
        "oracle+cx_oracle://", creator=pool.acquire, poolclass=NullPool
    )

The above engine may then be used normally where cx_Oracle's pool handles
connection pooling::

    with engine.connect() as conn:
        print(conn.scalar("select 1 from dual"))

As well as providing a scalable solution for multi-user applications, the
cx_Oracle session pool supports some Oracle features such as DRCP and
`Application Continuity
<https://cx-oracle.readthedocs.io/en/latest/user_guide/ha.html#application-continuity-ac>`_.

Note that the pool creation parameters ``threaded``, ``encoding`` and
``nencoding`` were deprecated in later cx_Oracle releases.

Using Oracle Database Resident Connection Pooling (DRCP)
--------------------------------------------------------

When using Oracle Database's DRCP, the best practice is to pass a connection
class and "purity" when acquiring a connection from the SessionPool.  Refer to
the `cx_Oracle DRCP documentation
<https://cx-oracle.readthedocs.io/en/latest/user_guide/connection_handling.html#database-resident-connection-pooling-drcp>`_.

This can be achieved by wrapping ``pool.acquire()``::

    import cx_Oracle
    from sqlalchemy import create_engine
    from sqlalchemy.pool import NullPool

    pool = cx_Oracle.SessionPool(
        user="scott",
        password="tiger",
        dsn="orclpdb",
        min=2,
        max=5,
        increment=1,
        threaded=True,
        encoding="UTF-8",
        nencoding="UTF-8",
    )


    def creator():
        return pool.acquire(
            cclass="MYCLASS", purity=cx_Oracle.ATTR_PURITY_SELF
        )


    engine = create_engine(
        "oracle+cx_oracle://", creator=creator, poolclass=NullPool
    )

The above engine may then be used normally where cx_Oracle handles session
pooling and Oracle Database additionally uses DRCP::

    with engine.connect() as conn:
        print(conn.scalar("select 1 from dual"))

.. _cx_oracle_unicode:

Unicode
-------

As is the case for all DBAPIs under Python 3, all strings are inherently
Unicode strings. In all cases however, the driver requires an explicit
encoding configuration.

Ensuring the Correct Client Encoding
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The long accepted standard for establishing client encoding for nearly all
Oracle Database related software is via the `NLS_LANG
<https://www.oracle.com/database/technologies/faq-nls-lang.html>`_ environment
variable.  Older versions of cx_Oracle use this environment variable as the
source of its encoding configuration.  The format of this variable is
Territory_Country.CharacterSet; a typical value would be
``AMERICAN_AMERICA.AL32UTF8``.  cx_Oracle version 8 and later use the character
set "UTF-8" by default, and ignore the character set component of NLS_LANG.

The cx_Oracle driver also supported a programmatic alternative which is to pass
the ``encoding`` and ``nencoding`` parameters directly to its ``.connect()``
function.  These can be present in the URL as follows::

    engine = create_engine(
        "oracle+cx_oracle://scott:tiger@tnsalias?encoding=UTF-8&nencoding=UTF-8"
    )

For the meaning of the ``encoding`` and ``nencoding`` parameters, please
consult
`Characters Sets and National Language Support (NLS) <https://cx-oracle.readthedocs.io/en/latest/user_guide/globalization.html#globalization>`_.

.. seealso::

    `Characters Sets and National Language Support (NLS) <https://cx-oracle.readthedocs.io/en/latest/user_guide/globalization.html#globalization>`_
    - in the cx_Oracle documentation.


Unicode-specific Column datatypes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The Core expression language handles unicode data by use of the
:class:`.Unicode` and :class:`.UnicodeText` datatypes.  These types correspond
to the VARCHAR2 and CLOB Oracle Database datatypes by default.  When using
these datatypes with Unicode data, it is expected that the database is
configured with a Unicode-aware character set, as well as that the ``NLS_LANG``
environment variable is set appropriately (this applies to older versions of
cx_Oracle), so that the VARCHAR2 and CLOB datatypes can accommodate the data.

In the case that Oracle Database is not configured with a Unicode character
set, the two options are to use the :class:`_types.NCHAR` and
:class:`_oracle.NCLOB` datatypes explicitly, or to pass the flag
``use_nchar_for_unicode=True`` to :func:`_sa.create_engine`, which will cause
the SQLAlchemy dialect to use NCHAR/NCLOB for the :class:`.Unicode` /
:class:`.UnicodeText` datatypes instead of VARCHAR/CLOB.

.. versionchanged:: 1.3 The :class:`.Unicode` and :class:`.UnicodeText`
   datatypes now correspond to the ``VARCHAR2`` and ``CLOB`` Oracle Database
   datatypes unless the ``use_nchar_for_unicode=True`` is passed to the dialect
   when :func:`_sa.create_engine` is called.


.. _cx_oracle_unicode_encoding_errors:

Encoding Errors
^^^^^^^^^^^^^^^

For the unusual case that data in Oracle Database is present with a broken
encoding, the dialect accepts a parameter ``encoding_errors`` which will be
passed to Unicode decoding functions in order to affect how decoding errors are
handled.  The value is ultimately consumed by the Python `decode
<https://docs.python.org/3/library/stdtypes.html#bytes.decode>`_ function, and
is passed both via cx_Oracle's ``encodingErrors`` parameter consumed by
``Cursor.var()``, as well as SQLAlchemy's own decoding function, as the
cx_Oracle dialect makes use of both under different circumstances.

.. versionadded:: 1.3.11


.. _cx_oracle_setinputsizes:

Fine grained control over cx_Oracle data binding performance with setinputsizes
-------------------------------------------------------------------------------

The cx_Oracle DBAPI has a deep and fundamental reliance upon the usage of the
DBAPI ``setinputsizes()`` call.  The purpose of this call is to establish the
datatypes that are bound to a SQL statement for Python values being passed as
parameters.  While virtually no other DBAPI assigns any use to the
``setinputsizes()`` call, the cx_Oracle DBAPI relies upon it heavily in its
interactions with the Oracle Database client interface, and in some scenarios
it is not possible for SQLAlchemy to know exactly how data should be bound, as
some settings can cause profoundly different performance characteristics, while
altering the type coercion behavior at the same time.

Users of the cx_Oracle dialect are **strongly encouraged** to read through
cx_Oracle's list of built-in datatype symbols at
https://cx-oracle.readthedocs.io/en/latest/api_manual/module.html#database-types.
Note that in some cases, significant performance degradation can occur when
using these types vs. not, in particular when specifying ``cx_Oracle.CLOB``.

On the SQLAlchemy side, the :meth:`.DialectEvents.do_setinputsizes` event can
be used both for runtime visibility (e.g. logging) of the setinputsizes step as
well as to fully control how ``setinputsizes()`` is used on a per-statement
basis.

.. versionadded:: 1.2.9 Added :meth:`.DialectEvents.setinputsizes`


Example 1 - logging all setinputsizes calls
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following example illustrates how to log the intermediary values from a
SQLAlchemy perspective before they are converted to the raw ``setinputsizes()``
parameter dictionary.  The keys of the dictionary are :class:`.BindParameter`
objects which have a ``.key`` and a ``.type`` attribute::

    from sqlalchemy import create_engine, event

    engine = create_engine("oracle+cx_oracle://scott:tiger@host/xe")


    @event.listens_for(engine, "do_setinputsizes")
    def _log_setinputsizes(inputsizes, cursor, statement, parameters, context):
        for bindparam, dbapitype in inputsizes.items():
            log.info(
                "Bound parameter name: %s  SQLAlchemy type: %r DBAPI object: %s",
                bindparam.key,
                bindparam.type,
                dbapitype,
            )

Example 2 - remove all bindings to CLOB
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``CLOB`` datatype in cx_Oracle incurs a significant performance overhead,
however is set by default for the ``Text`` type within the SQLAlchemy 1.2
series.   This setting can be modified as follows::

    from sqlalchemy import create_engine, event
    from cx_Oracle import CLOB

    engine = create_engine("oracle+cx_oracle://scott:tiger@host/xe")


    @event.listens_for(engine, "do_setinputsizes")
    def _remove_clob(inputsizes, cursor, statement, parameters, context):
        for bindparam, dbapitype in list(inputsizes.items()):
            if dbapitype is CLOB:
                del inputsizes[bindparam]

.. _cx_oracle_lob:

LOB Datatypes
--------------

LOB datatypes refer to the "large object" datatypes such as CLOB, NCLOB and
BLOB. Modern versions of cx_Oracle is optimized for these datatypes to be
delivered as a single buffer. As such, SQLAlchemy makes use of these newer type
handlers by default.

To disable the use of newer type handlers and deliver LOB objects as classic
buffered objects with a ``read()`` method, the parameter
``auto_convert_lobs=False`` may be passed to :func:`_sa.create_engine`,
which takes place only engine-wide.

.. _cx_oracle_returning:

RETURNING Support
-----------------

The cx_Oracle dialect implements RETURNING using OUT parameters.
The dialect supports RETURNING fully.

Two Phase Transactions Not Supported
------------------------------------

Two phase transactions are **not supported** under cx_Oracle due to poor driver
support. The newer :ref:`oracledb` dialect however **does** support two phase
transactions.

.. _cx_oracle_numeric:

Precision Numerics
------------------

SQLAlchemy's numeric types can handle receiving and returning values as Python
``Decimal`` objects or float objects.  When a :class:`.Numeric` object, or a
subclass such as :class:`.Float`, :class:`_oracle.DOUBLE_PRECISION` etc. is in
use, the :paramref:`.Numeric.asdecimal` flag determines if values should be
coerced to ``Decimal`` upon return, or returned as float objects.  To make
matters more complicated under Oracle Database, the ``NUMBER`` type can also
represent integer values if the "scale" is zero, so the Oracle
Database-specific :class:`_oracle.NUMBER` type takes this into account as well.

The cx_Oracle dialect makes extensive use of connection- and cursor-level
"outputtypehandler" callables in order to coerce numeric values as requested.
These callables are specific to the specific flavor of :class:`.Numeric` in
use, as well as if no SQLAlchemy typing objects are present.  There are
observed scenarios where Oracle Database may send incomplete or ambiguous
information about the numeric types being returned, such as a query where the
numeric types are buried under multiple levels of subquery.  The type handlers
do their best to make the right decision in all cases, deferring to the
underlying cx_Oracle DBAPI for all those cases where the driver can make the
best decision.

When no typing objects are present, as when executing plain SQL strings, a
default "outputtypehandler" is present which will generally return numeric
values which specify precision and scale as Python ``Decimal`` objects.  To
disable this coercion to decimal for performance reasons, pass the flag
``coerce_to_decimal=False`` to :func:`_sa.create_engine`::

    engine = create_engine("oracle+cx_oracle://dsn", coerce_to_decimal=False)

The ``coerce_to_decimal`` flag only impacts the results of plain string
SQL statements that are not otherwise associated with a :class:`.Numeric`
SQLAlchemy type (or a subclass of such).

.. versionchanged:: 1.2  The numeric handling system for cx_Oracle has been
   reworked to take advantage of newer cx_Oracle features as well
   as better integration of outputtypehandlers.

    )annotationsN   )base)OracleCompiler)OracleDialect)OracleExecutionContext)_OracleDateLiteralRender   )exc)util)cursor)
interfaces)
processors)sqltypes)is_sql_compileri   c                       e Zd Zd ZddZd Zy)_OracleIntegerc                    t         S Nintselfdbapis     MD:\EasyAligner\venv\Lib\site-packages\sqlalchemy/dialects/oracle/cx_oracle.pyget_dbapi_typez_OracleInteger.get_dbapi_type  s	     
    Nc                    |j                   }|j                  |j                  d||t              S |j                  t              S )N   	arraysizeoutconverter)r   varSTRINGr!   r   )r   dialectr   r!   	cx_Oracles        r   _cx_oracle_varz_OracleInteger._cx_oracle_var
  sV    MM	zz#,#8i	  
 	
 ?E>N>N	  
 	
r   c                      fd}|S )Nc                (    j                  |       S r   )r'   )r   namedefault_typesize	precisionscaler%   r   s         r   handlerz<_OracleInteger._cx_oracle_outputtypehandler.<locals>.handler  s    &&w77r    )r   r%   r/   s   `` r   _cx_oracle_outputtypehandlerz+_OracleInteger._cx_oracle_outputtypehandler  s    	8 r   r   )__name__
__module____qualname__r   r'   r1   r0   r   r   r   r     s    

r   r   c                  "    e Zd ZdZd Zd Zd Zy)_OracleNumericFc                    | j                   dk(  ry | j                  r5t        j                  t        j
                  | j                        fd}|S t        j                  S )Nr   c                ~    t        | t        t        f      r |       S | | j                         rt        |       S | S r   )
isinstancer   floatis_infinite)value	processors    r   processz._OracleNumeric.bind_processor.<locals>.process%  s<    ec5\2$U++&5+<+<+> <' Lr   )r.   	asdecimalr   to_decimal_processor_factorydecimalDecimal_effective_decimal_return_scaleto_float)r   r%   r>   r=   s      @r   bind_processorz_OracleNumeric.bind_processor  sO    ::?^^"??!E!EI! N&&&r   c                     y r   r0   )r   r%   coltypes      r   result_processorz_OracleNumeric.result_processor1      r   c                .     |j                    fd}|S )Nc                   d }|r^	j                   r3|j                  k(  r|}t        j                  }nt        j                  }n|	j                  r|dk(  ry j                  }n]	j                   r3|j                  k(  r|}t        j                  }n/t        j                  }n	j                  r|dk(  ry j                  }| j                  |d| j                  |      S )Nr   r   r    )r?   NATIVE_FLOATrA   rB   	is_numberr#   r!   )
r   r*   r+   r,   r-   r.   r"   type_r&   r   s
           r   r/   z<_OracleNumeric._cx_oracle_outputtypehandler.<locals>.handler7  s    L>>#y'='== !-'. '~~%1*  $ ) 6 6 >>#y'='== ,'. '~~%1*  $ ) 6 6:: **)	   r   )r   )r   r%   r/   r&   s   `  @r   r1   z+_OracleNumeric._cx_oracle_outputtypehandler4  s    MM	*	X r   N)r2   r3   r4   rM   rE   rH   r1   r0   r   r   r6   r6     s    I'(/r   r6   c                      e Zd Zd Zy)_OracleUUIDc                    |j                   S r   )r$   r   s     r   r   z_OracleUUID.get_dbapi_typeg  s    ||r   Nr2   r3   r4   r   r0   r   r   rP   rP   f  s    r   rP   c                      e Zd Zd Zy)_OracleBinaryFloatc                    |j                   S r   )rL   r   s     r   r   z!_OracleBinaryFloat.get_dbapi_typel  s    !!!r   NrR   r0   r   r   rT   rT   k  s    "r   rT   c                      e Zd Zy)_OracleBINARY_FLOATNr2   r3   r4   r0   r   r   rW   rW   p      r   rW   c                      e Zd Zy)_OracleBINARY_DOUBLENrX   r0   r   r   r[   r[   t  rY   r   r[   c                      e Zd ZdZy)_OracleNUMBERTN)r2   r3   r4   rM   r0   r   r   r]   r]   x  s    Ir   r]   c                      e Zd Zd Zd Zy)_CXOracleDatec                     y r   r0   r   r%   s     r   rE   z_CXOracleDate.bind_processor}  rI   r   c                    d }|S )Nc                *    | | j                         S | S r   )dater<   s    r   r>   z/_CXOracleDate.result_processor.<locals>.process  s     zz|#r   r0   )r   r%   rG   r>   s       r   rH   z_CXOracleDate.result_processor  s    	 r   N)r2   r3   r4   rE   rH   r0   r   r   r_   r_   |  s    r   r_   c                      e Zd Zd Zy)_CXOracleTIMESTAMPc                $    | j                  |      S r   )_literal_processor_datetimera   s     r   literal_processorz$_CXOracleTIMESTAMP.literal_processor  s    //88r   N)r2   r3   r4   rj   r0   r   r   rg   rg     s    9r   rg   c                      e Zd Zy)_LOBDataTypeNrX   r0   r   r   rl   rl     rY   r   rl   c                      e Zd Zd Zy)_OracleCharc                    |j                   S r   )
FIXED_CHARr   s     r   r   z_OracleChar.get_dbapi_type  s    r   NrR   r0   r   r   rn   rn     s     r   rn   c                      e Zd Zd Zy)_OracleNCharc                    |j                   S r   )FIXED_NCHARr   s     r   r   z_OracleNChar.get_dbapi_type         r   NrR   r0   r   r   rr   rr         !r   rr   c                      e Zd Zd Zy)_OracleUnicodeStringNCHARc                    |j                   S r   )NCHARr   s     r   r   z(_OracleUnicodeStringNCHAR.get_dbapi_type      {{r   NrR   r0   r   r   rx   rx         r   rx   c                      e Zd Zd Zy)_OracleUnicodeStringCHARc                    |j                   S r   LONG_STRINGr   s     r   r   z'_OracleUnicodeStringCHAR.get_dbapi_type  ru   r   NrR   r0   r   r   r~   r~     rv   r   r~   c                      e Zd Zd Zy)_OracleUnicodeTextNCLOBc                    |j                   S r   DB_TYPE_NVARCHARr   s     r   r   z&_OracleUnicodeTextNCLOB.get_dbapi_type       %%%r   NrR   r0   r   r   r   r         &r   r   c                      e Zd Zd Zy)_OracleUnicodeTextCLOBc                    |j                   S r   r   r   s     r   r   z%_OracleUnicodeTextCLOB.get_dbapi_type  r   r   NrR   r0   r   r   r   r     r   r   r   c                      e Zd Zd Zy)_OracleTextc                    |j                   S r   r   r   s     r   r   z_OracleText.get_dbapi_type  r   r   NrR   r0   r   r   r   r     r   r   r   c                      e Zd Zd Zy)_OracleLongc                    |j                   S r   r   r   s     r   r   z_OracleLong.get_dbapi_type  ru   r   NrR   r0   r   r   r   r     rv   r   r   c                      e Zd Zy)_OracleStringNrX   r0   r   r   r   r     rY   r   r   c                      e Zd Zd Zy)_OracleEnumc                R    t         j                  j                  | |      fd}|S )Nc                     |       }|S r   r0   )r<   raw_str	enum_procs     r   r>   z+_OracleEnum.bind_processor.<locals>.process  s    &GNr   )r   EnumrE   )r   r%   r>   r   s      @r   rE   z_OracleEnum.bind_processor  s%    MM00w?		 r   N)r2   r3   r4   rE   r0   r   r   r   r     s    r   r   c                  *     e Zd Zd Zd Z fdZ xZS )_OracleBinaryc                    |j                   S r   )DB_TYPE_RAWr   s     r   r   z_OracleBinary.get_dbapi_type  s        r   c                     y r   r0   ra   s     r   rE   z_OracleBinary.bind_processor  rI   r   c                >    |j                   sy t        | 	  ||      S r   )auto_convert_lobssuperrH   )r   r%   rG   	__class__s      r   rH   z_OracleBinary.result_processor  s!    ((7+GW==r   )r2   r3   r4   r   rE   rH   __classcell__r   s   @r   r   r     s    !> >r   r   c                      e Zd Zd Zy)_OracleIntervalc                    |j                   S r   )INTERVALr   s     r   r   z_OracleInterval.get_dbapi_type  s    ~~r   NrR   r0   r   r   r   r     s    r   r   c                      e Zd Zy)
_OracleRawNrX   r0   r   r   r   r     rY   r   r   c                      e Zd Zd Zy)_OracleRowidc                    |j                   S r   )ROWIDr   s     r   r   z_OracleRowid.get_dbapi_type  r{   r   NrR   r0   r   r   r   r     r|   r   r   c                  V    e Zd ZdZdZ ej                  dddddddddddd      Zd Zy	)
OracleCompiler_cx_oracleTFPAZC)%():.[] \/?c                6    t        |dd       }|du s1|durP j                  j                  |      r5|j                  dd      s#d|z  }||d<   |}t	        j
                   |fi |S |j                  dd       }|s j                  j                  |      rG j                  j                   fd|      }|d   j                         s|d   d	k(  rd
|z   }||d<   |}n'|d   j                         s|d   d	k(  rd
|z   }||d<   |}t	        j
                   |fi |S )NquoteTFpost_compilez"%s"escaped_fromc                @    j                   | j                  d         S Nr   )_bind_translate_charsgroup)mr   s    r   <lambda>z;OracleCompiler_cx_oracle.bindparam_string.<locals>.<lambda>,  s    d88Dr   r   _D)
getattrpreparer_bindparam_requires_quotesgetr   bindparam_string_bind_translate_researchsubisdigit)r   r*   kwr   quoted_namer   new_names   `      r   r   z)OracleCompiler_cx_oracle.bindparam_string  s8   gt,TME!88>
 FF>51 !4-K!%B~D!224DDD vvnd3&&--d3  2266D A;&&(HQK3,>"X~H%)>"a"d1gn:%)>"..tT@R@@r   N)	r2   r3   r4   _oracle_cx_sql_compiler_oracle_returningr   immutabledictbindname_escape_charactersr   r0   r   r   r   r     sO    " "4!3!3	
" +Ar   r   c                  R     e Zd ZdZd Zd Zd Z fdZd Zd Z	dd	d
Z
d Z xZS ) OracleExecutionContext_cx_oracleNc                   | j                   j                  s| j                   j                  rZ| j                  }|J t	        | j
                        }| j                   j                  }| j                   j                  j                         D ]  }|j                  s| j                   j                  |   }|j                  j                  | j                        }t        |d      r-|j                  | j                  | j                   |      ||<   nF|j#                  | j                  j$                        }| j                  j$                  }|J |0t'        j(                  d|j*                  d|j                  d      t-        |t.              rZ||j0                  k(  r|j2                  }n||j4                  k(  r|j6                  }| j                   j9                  |d |      ||<   nkt-        |t:              r;|j<                  r/| j                   j9                  t>        j@                  |      ||<   n | j                   j9                  ||      ||<   | j
                  D ]  }	||   |	|jC                  ||      <     y y )Nr'   r!   z*Cannot create out parameter for parameter z - its type z is not supported by cx_oraclec                "    | j                         S r   )readre   s    r   r   zOOracleExecutionContext_cx_oracle._generate_out_parameter_vars.<locals>.<lambda>w  s
    5::<r   r"   r!   )"compiledhas_out_parametersr   out_parameterslen
parametersescaped_bind_namesbindsvalues
isoutparam
bind_namestypedialect_implr%   hasattrr'   r   r   r   r   InvalidRequestErrorkeyr9   rl   r   NCLOBr   BLOBr#   r6   r?   rA   rB   r   )
r   r   
len_paramsquoted_bind_names	bindparamr*   	type_impldbtyper&   params
             r   _generate_out_parameter_varsz=OracleExecutionContext_cx_oracle._generate_out_parameter_vars>  s9    ==++t}}/N/N!00N!---T__-J $ @ @!]]00779	''==33I>D ) ; ;DLL IIy*:;/8/G/G LL$++ 0H 0t, "+!9!9$,,:L:L!M$(LL$6$6	(444!>"%"9"9 1:y~~!O# & &i>%)C)CC)2!'9+@+@!@)2 48;;?? & .H*4 4C 4N40 'y.A ) 3 337;;?? '*4 4C 4N40 48;;?? &* 4C 4N40 "&*40 /33D$?@ "1A : 0Or   c                @  	 i 	| j                   j                  D ]Q  \  }}}}|j                  | j                  d| j                        }|s2| j                  j                  |      }|	|<   S 	r.| j                  j                  	fd}|| j                  _        y y )Ncx_oracle_outputtypehandlerc                F    |v r |   | |||||      S  | |||||      S r   r0   )r   r*   r+   r,   r-   r.   default_handleroutput_handlerss         r   output_type_handlerzaOracleExecutionContext_cx_oracle._generate_cursor_outputtype_handler.<locals>.output_type_handler  sJ     ?*0?40lD)U  +lD)U r   )	r   _result_columns_cached_custom_processorr%   _get_cx_oracle_type_handlerdenormalize_name_dbapi_connectionoutputtypehandlerr   )
r   keynamer*   objectsrN   r/   denormalized_namer  r   r   s
           @@r   #_generate_cursor_outputtype_handlerzDOracleExecutionContext_cx_oracle._generate_cursor_outputtype_handler  s    -1]]-J-J)GT7E44-00G $(LL$A$A'$J!5< 12 .K "44FFO
 -@DKK) r   c                R    t        |d      r|j                  | j                        S y )Nr1   )r   r1   r%   )r   impls     r   r  z<OracleExecutionContext_cx_oracle._get_cx_oracle_type_handler  s%    47844T\\BBr   c                    t         |           t        | j                  dd      sy i | _        | j                          | j                          y )Nr   F)r   pre_execr   r   r   r   r  )r   r   s    r   r  z)OracleExecutionContext_cx_oracle.pre_exec  sB    t}}&?G ))+002r   c                j   | j                   rt        | j                         r| j                   j                  ru| j                  | j                  d      }t        j                  | j                  | j                   j                  D cg c]  }|j                  d f c}|      }|| _	        y y y y c c}w )NT	_internal)initial_buffer)
r   r   r   fetchall_for_returningr   _cursor FullyBufferedCursorFetchStrategyr  r  cursor_fetch_strategy)r   r  entryfetch_strategys       r   	post_execz*OracleExecutionContext_cx_oracle.post_exec  s    MM.//!88t 9 N %EE "&!>!>!> ]]D)!>  .N *8D& 0 / s   B0
c                    | j                   j                         }| j                  j                  r| j                  j                  |_        |S r   )r  r   r%   r!   )r   cs     r   create_cursorz.OracleExecutionContext_cx_oracle.create_cursor  s9    ""))+<<!!,,00AKr   Fr  c               l   | j                   }|s|t        |      r|j                  st        d      t	        | j
                        }t        t        t        |      D cg c]9  }| j
                  d|    j                  D cg c]  }|xs dD ]  }|  c}}; c}}}       S c c}}w c c}}}w )Nz7execution context was not prepared for Oracle RETURNINGret_r0   )
r   r   r   NotImplementedErrorr   r   listzipranger   )r   r   r  r   numcolsjstmt_resultvals           r   r  z7OracleExecutionContext_cx_oracle.fetchall_for_returning  s    == "8,--%I  d))*  #7^	 , ,0+>+>"1#J, &,!,!K %0$52$5C	  %6	 ,! ,	
 	
	s   !$B/B)B/)B/c                    | j                   j                  rJ |D cg c]*  }| j                  j                  | j                  |         , c}S c c}w r   )r   	returningr%   	_paramvalr   )r   out_param_namesr*   s      r   get_out_parameter_valuesz9OracleExecutionContext_cx_oracle.get_out_parameter_values  sX     ==**** (
' LL""4#6#6t#<='
 	
 
s   /A)r2   r3   r4   r   r   r  r  r  r  r  r  r,  r   r   s   @r   r   r   ;  s:    NM^@>	38* ;@ #
J	
r   r   c                  N    e Zd ZdZeZeZdZdZ	dZ
dZdZdZej                  j                   ZdZ ej(                  ej,                  i ej0                  eej4                  eej8                  eej<                  eej@                  e!ejD                  e#ejH                  e%ejL                  e'ejP                  e)ejT                  ejV                  ejX                  e-ej\                  e-ej^                  e0ejb                  e2ejf                  e4ejj                  e6ejn                  e8ejr                  e:ejv                  e<ejz                  e>ej~                  e@ej                  eBej                  eDej                  eFej                  eHi      ZeIZJdZK ej                         ZM ej                  d      	 	 	 	 	 dd       ZOd ZPeQd        ZR fd	ZSd
 ZT fdZUd ZVd ZWd ZXeYj                  Z[d Z\d Z]d Z^d Z_d Z`d ZaddZbd Zcd Zd	 ddZe	 ddZfd Zgd Zh xZiS )OracleDialect_cx_oracleT	cx_oracleN)1.3aA  The 'threaded' parameter to the cx_oracle/oracledb dialect is deprecated as a dialect-level argument, and will be removed in a future release.  As of version 1.3, it defaults to False rather than True.  The 'threaded' option can be passed to cx_Oracle directly in the URL query string passed to :func:`_sa.create_engine`.)threadedc                   t        j                  | fi | || _        || _        |r	d|i| _        ||| _        || _        || _        | j                  ra| j                  j                         | _	        t        | j                  t        j                  <   t        | j                  t        j                  <   | j                   }| j#                  |       ||j$                  |j&                  |j(                  |j*                  |j,                  |j.                  |j0                  |j2                  |j4                  |j6                  |j8                  t:        |j<                  h| _        d | _         y y )NencodingErrorsc                "    | j                         S r   )getvaluere   s    r   r   z2OracleDialect_cx_oracle.__init__.<locals>.<lambda>~  s    5>>+;r   )!r   __init__r!   encoding_errors_cursor_var_unicode_kwargs_cx_oracle_threadedr   coerce_to_decimal_use_nchar_for_unicodecolspecscopyrx   r   Unicoder   UnicodeTextr   _load_versionDATETIMEr   r   r   CLOBLOBr   rz   rt   rp   	TIMESTAMPr   rL   include_set_input_sizesr*  )r   r   r:  r!   r7  r1  kwargsdbapi_modules           r   r6  z OracleDialect_cx_oracle.__init__@  sC   ( 	t.v.". //D+ '/D$!2!2&& MM..0DM.GDMM(**+2IDMM(../zz<(# %%--((""!!  !!""((''&&)),D(" <DN/ $r   c                   d}|Et        j                  d|j                        }|r#t        d |j	                  ddd      D              }|| _        | j
                  dk  r%| j
                  dkD  rt        j                  d      y y )	N)r   r   r   z(\d+)\.(\d+)(?:\.(\d+))?c              3  8   K   | ]  }|t        |        y wr   r   .0xs     r   	<genexpr>z8OracleDialect_cx_oracle._load_version.<locals>.<genexpr>  s       $4qCF$4s   r      r
   )   z+cx_Oracle version 8 and above are supported)rematchversiontupler   cx_oracle_verr   r   )r   rG  rR  r   s       r   r@  z%OracleDialect_cx_oracle._load_version  s    #4l6J6JKA  $%GGAq!$4   %$););i)G))=  *H$r   c                    dd l }|S r   )r&   )clsr&   s     r   import_dbapiz$OracleDialect_cx_oracle.import_dbapi  s    r   c                F    t         |   |       | j                  |       y r   )r   
initialize_detect_decimal_char)r   
connectionr   s     r   rY  z"OracleDialect_cx_oracle.initialize  s    :&!!*-r   c                t   |j                         5 }|j                  t              }|j                  dd|i       |j	                         }|j                  dd      \  }}}|j                  d|||d       |j                         }|t        j                  d      |d   }	d d d        |	S # 1 sw Y   	S xY w)	Nz
                begin
                   :trans_id := dbms_transaction.local_transaction_id( TRUE );
                end;
                trans_idr   rN  zSELECT CASE BITAND(t.flag, POWER(2, 28)) WHEN 0 THEN 'READ COMMITTED' ELSE 'SERIALIZABLE' END AS isolation_level FROM v$transaction t WHERE (t.xidusn, t.xidslot, t.xidsqn) = ((:xidusn, :xidslot, :xidsqn)))xidusnxidslotxidsqnz"could not retrieve isolation levelr   )	r   r#   strexecuter5  splitfetchoner   r   )
r   dbapi_connectionr   outvalr]  r^  r_  r`  rowresults
             r   get_isolation_levelz+OracleDialect_cx_oracle.get_isolation_level  s     $$&&
 ZZ_FNN
 V$ (H&.nnS!&<#FGVNN1 "gH //#C{--8  VF? 'B C 'B s   BB--B7c                *    t         |   |      dgz   S )N
AUTOCOMMIT)r   get_isolation_level_values)r   re  r   s     r   rl  z2OracleDialect_cx_oracle.get_isolation_level_values  s$    w12BCG
 
 	
r   c                    |dk(  rd|_         y d|_         |j                          |j                         5 }|j                  d|        d d d        y # 1 sw Y   y xY w)Nrk  TFz"ALTER SESSION SET ISOLATION_LEVEL=)
autocommitrollbackr   rb  )r   re  levelr   s       r   set_isolation_levelz+OracleDialect_cx_oracle.set_isolation_level  sV    L *.'*/'%%'!((*f!CE7KL +**s   AAc                    |j                   }|j                         5 } fd}||_        |j                  d       |j	                         d   }|j                  d      d   }|d   j                         rJ 	 d d d         _         j                  dk7  r/ j                   j                   fd _         fd _	        y y # 1 sw Y   OxY w)	Nc                h    | j                  j                  j                  d| j                        S )Nr   r   )r#   r   r$   r!   )r   r*   defaultTyper,   r-   r.   r   s         r   r  zIOracleDialect_cx_oracle._detect_decimal_char.<locals>.output_type_handler  s2     zzJJ%%sf6F6F "  r   zSELECT 1.1 FROM DUALr   0r   r   c                H     | j                  j                  d            S Nr   replace_decimal_char)r<   _detect_decimalr   s    r   r   z>OracleDialect_cx_oracle._detect_decimal_char.<locals>.<lambda>  s    d00#62r   c                H     | j                  j                  d            S rw  rx  )r<   _to_decimalr   s    r   r   z>OracleDialect_cx_oracle._detect_decimal_char.<locals>.<lambda>  s    [d00#6.r   )
r[  r   r  rb  rd  lstripr   rz  r{  r}  )	r   r[  re  r   r  r<   decimal_charr{  r}  s	   `      @@r   rZ  z,OracleDialect_cx_oracle._detect_decimal_char  s     &00$$&& (;F$NN12OO%a(E <<,Q/L#A..0000+ '. *$"22O**K$D  D %3 '&s   AC		Cc                B    d|v r| j                  |      S t        |      S rw  )r}  r   )r   r<   s     r   r{  z'OracleDialect_cx_oracle._detect_decimal  s$    %<##E**u:r   c                    | j                   t        d      j                        t        d      j                        fd}|S )z^establish the default outputtypehandler established at the
        connection level.

        T)r?   Fc                r   |j                   k(  rx|j                  urjj                  sy |dk(  r7|dv r3| j                  j                  dj
                  | j                        S |r|dkD  r 
| |||||      S  	| |||||      S j                  rc|j                  j                  fv rI|j                  ur;|j                  ur- | j                  t        || j                  fi j                  S j                  rm|j                  j                  fv rS|j                  u rj                  nj                  } | j                  |t        | j                  fi j                  S j                  r;|j                   fv r+| j                  j"                  t        | j                        S y y )Nr   )r   ir   r   )NUMBERrL   r:  r#   r$   r{  r!   r8  rp   rB  r   ra  r   DB_TYPE_VARCHARr   _CX_ORACLE_MAGIC_LOB_SIZEr   r   )r   r*   r+   r,   r-   r.   typr&   r%   float_handlernumber_handlers          r   r  z\OracleDialect_cx_oracle._generate_connection_outputtype_handler.<locals>.output_type_handler  s    	 0 00 	(>(>>00!^(: "::!((%,%<%<"("2"2	 &   519)lD)U  )lD)U  22 $$((
 !	6 	7!vzz$$ 88	  **|@ 0 $y~~5 --"33 
 "vzz-$$ 88	  **|@ 0 zz))-$$ 0*r   )r   r]   r1   )r   r  r&   r%   r  r  s     @@@@r   '_generate_connection_outputtype_handlerz?OracleDialect_cx_oracle._generate_connection_outputtype_handler
  sZ     MM	&

&
&w
/ 	 &

&
&w
/ 	E	N #"r   c                2    | j                         fd}|S )Nc                    | _         y r   )r  )connr  s    r   
on_connectz6OracleDialect_cx_oracle.on_connect.<locals>.on_connectf  s    %8D"r   )r  )r   r  r  s     @r   r  z"OracleDialect_cx_oracle.on_connectc  s    "JJL	9 r   c                    t        |j                        }dD ]e  }||v st        j                   j                   d|dd       t        j
                  ||t               t         ||j                  |             g |j                  }|j                  dd       }|s|rj|j                  }|rt        |      }nd}|r|rt        j                  d      |rd	|i}|rd|i}  j                  j                  |j                   |fi }n|j                   }|||d
<   |j"                  |j"                  |d<   |j$                  |j$                  |d<    j&                  |j)                  d j&                          fd}	t        j
                  |d|	       t        j
                  |dt               t        j
                  |dt               t        j
                  |d|	       g |fS )N)use_ansir   z dialect option zK should only be passed to create_engine directly, not within the URL stringr0  )rR  service_namei  zI"service_name" option shouldn't be used with a "database" part of the urlsiddsnpassworduserr1  c                    t        | t              r	 t        |       }|S | S # t        $ r) | j	                         } t        j                  |       cY S w xY wr   )r9   ra  r   
ValueErrorupperr   r   )r<   int_valr   s     r   convert_cx_oracle_constantzOOracleDialect_cx_oracle.create_connect_args.<locals>.convert_cx_oracle_constant  sT    %%#!%jG
 #N " 6!KKME"4::u556s   " /AAmodeeventspurity)dictqueryr   warn_deprecateddrivercoerce_kw_typeboolsetattrpopdatabaseportr   r   r   r   makedsnhostr  usernamer9  
setdefault)
r   urloptsoptr  r  r  makedsn_kwargsr  r  s
   `         r   create_connect_argsz+OracleDialect_cx_oracle.create_connect_argsk  s   CII4Cd{$${{m#3C7 ;  "	 ##D#t4c488C=1 5 <<xx5|88D4yL--@  "'!2"0,!?$$**$$SXXtF~FC ((C?DK<<#"||D<<#<<DL##/OOJ(@(@A
	 	D&*DED*d3D(D1D(,FGDzr   c                l    t        d |j                  j                  j                  d      D              S )Nc              3  2   K   | ]  }t        |        y wr   r   rJ  s     r   rM  zCOracleDialect_cx_oracle._get_server_version_info.<locals>.<genexpr>  s     N%MSV%Ms   r   )rS  r[  rR  rc  r   r[  s     r   _get_server_version_infoz0OracleDialect_cx_oracle._get_server_version_info  s*    NZ%:%:%B%B%H%H%MNNNr   c                   |j                   \  }t        || j                  j                  | j                  j                  f      rdt        |      v ryt        |d      r|j                  dv ryt        j                  dt        |            ryy)Nznot connectedTcode>   	  )  *  ?  \	     z(^(?:DPI-1010|DPI-1080|DPY-1001|DPY-4011)F)
argsr9   r   InterfaceErrorDatabaseErrorra  r   r  rP  rQ  )r   er[  r   errors        r   is_disconnectz%OracleDialect_cx_oracle.is_disconnect  s|    66

))4::+C+CD
Q'5&!ejj 5
 '
 88?QH r   c                J    t        j                  dddz        }dd|z  ddz  fS )Nr   rN     i4  z%032x	   )randomrandint)r   id_s     r   
create_xidz"OracleDialect_cx_oracle.create_xid  s+    nnQ3'#w{33r   c                ^    t        |t              rt        |      }|j                  ||       y r   )r9   rS  r!  executemany)r   r   	statementr   contexts        r   do_executemanyz&OracleDialect_cx_oracle.do_executemany  s&    j%(j)J9j1r   c                h     |j                   j                  |  ||j                   j                  d<   y )Ncx_oracle_xid)r[  begininfo)r   r[  xids      r   do_begin_twophasez)OracleDialect_cx_oracle.do_begin_twophase  s.    #
##S)69
""?3r   c                V    |j                   j                         }||j                  d<   y )Ncx_oracle_prepared)r[  preparer  )r   r[  r  rh  s       r   do_prepare_twophasez+OracleDialect_cx_oracle.do_prepare_twophase  s%    &&..006
,-r   c                :    | j                  |j                         y r   )do_rollbackr[  )r   r[  r  is_preparedrecovers        r   do_rollback_twophasez,OracleDialect_cx_oracle.do_rollback_twophase  s     	../r   c                    |s| j                  |j                         y |rt        d      |j                  d   }|r| j                  |j                         y y )Nz*2pc recovery not implemented for cx_Oracler  )	do_commitr[  r   r  )r   r[  r  r  r  oci_prepareds         r   do_commit_twophasez*OracleDialect_cx_oracle.do_commit_twophase  sW     NN:001)@  &??+?@Lz445 r   c           
         | j                   r& |j                  |D cg c]  \  }}}|
 c}}}  y d |D        } |j                  di |D ci c]  \  }}||
 c}} y c c}}}w c c}}w )Nc              3  0   K   | ]  \  }}}|r||f  y wr   r0   )rK  r   r   sqltypes       r   rM  z=OracleDialect_cx_oracle.do_set_input_sizes.<locals>.<genexpr>  s&      ,:(C f,:s   r0   )
positionalsetinputsizes)r   r   list_of_tuplesr  r   r   r  
collections           r   do_set_input_sizesz*OracleDialect_cx_oracle.do_set_input_sizes  s{    ?? !F  5CD^1S&'&^D,:J !F  O:#N:KCCK:#NO E $Os   A#A*c                    t        d      )Nz5recover two phase query for cx_Oracle not implemented)r   r  s     r   do_recover_twophasez+OracleDialect_cx_oracle.do_recover_twophase
  s    !C
 	
r   )TTNNNr   )TF)jr2   r3   r4   supports_statement_cacher   execution_ctx_clsr   statement_compilersupports_sane_rowcountsupports_sane_multi_rowcountinsert_executemany_returning4insert_executemany_returning_sort_by_parameter_orderupdate_executemany_returningdelete_executemany_returningr   
BindTypingSETINPUTSIZESbind_typingr  r   update_copyr   r<  r   rD  rg   Numericr6   FloatoracleBINARY_FLOATrW   BINARY_DOUBLEr[   Integerr   r  r]   Dater_   LargeBinaryr   Boolean_OracleBooleanIntervalr   r   Textr   Stringr   r?  r   CHARrn   rz   rr   r   r   LONGr   RAWr   r>  r~   NVARCHARrx   UuidrP   r   r   r   r   r!  execute_sequence_formatr9  r   r8  deprecated_paramsr6  r@  classmethodrW  rY  ri  rl  rq  rZ  r{  rA   rB   r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   s   @r   r.  r.  
  s   #81!#' #' ;?8#' #' ''55KFt	
 2	
n	
 NNN	
 !4		

   "6	
 n	
 MM=	
 MM=	
   -	
 f33	
 	
 OO_	
 MM;	
 OO]	
   "8	
  MM;!	
" NNL#	
$ MM;KKJJ
68MM;LL1LL,3	
H> #!3!3!3!5T

 3<
3<j  
.-^

M+Z //KW#rAFO!F42
:7
 :?0 :?6P 
r   r.  )K__doc__
__future__r   rA   r  rP   r   r  r   r   r   typesr	   r   r   enginer   r  r   r   sqlr   sql._typingr   r  r  r   r  r6   r	  rP   rT   r  rW   r  r[   r]   _OracleDater_   rD  rg   rl   r  rn   rz   rr   	NVARCHAR2rx   r>  r~   r   r   r?  r   r  r   r  r   r  r   r   r   r  r   r   r   r  r   r   r   r   r   r.  r%   r0   r   r   <module>r     s  aD #   	     ( +   '      * # X%% ,IX%% IX(-- 
" "
	,f.A.A 		-v/C/C 	N F&& 9183E3E 9
	 	 (--  
!8>> !
 0 0 
!x// !
&lFLL &&\8+?+? &&, &!, !
	HOO 	(-- >L("6"6 >"foo 
	 	6<< 
DA~ DANL
'= L
^C
m C
L "r   