
    i~                     \    d dl Z ddlmZ  G d d          Z e            Zd	dZdefdZdS )
    N   )errorsc                   :    e Zd ZdZd Zd Zd Zed             ZdS )DriverModeManagera  
    Manages the mode the driver is using. The "thin_mode" flag contains the
    current state:
        None: neither thick nor thin implementation has been used yet
        False: thick implementation is being used
        True: thin implementation is being used
    The "requested_thin_mode" is set to the mode that is being requested, but
    only while initialization is taking place (otherwise, it contains the value
    None):
        False: thick implementation is being initialized
        True: thin implementation is being initialized
    The condition is used to ensure that only one thread is performing
    initialization.
    c                 R    d | _         d | _        t          j                    | _        d S N)	thin_moderequested_thin_mode	threading	Condition	conditionselfs    d/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/oracledb/driver_mode.py__init__zDriverModeManager.__init__A   s%    #' ",..    c                     | S r    r   s    r   	__enter__zDriverModeManager.__enter__F   s    r   c                     | j         5  |||| j        | j        | _        d | _        | j                                          d d d            d S # 1 swxY w Y   d S r   )r   r
   r	   notify)r   exc_type	exc_valueexc_tbs       r   __exit__zDriverModeManager.__exit__I   s    ^ 		$ 		$ %N,8!%!9'+D$N!!###		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$ 		$s   :AAAc                 ,    | j         | j         S | j        S r   )r
   r	   r   s    r   thinzDriverModeManager.thinU   s    #/++~r   N)	__name__
__module____qualname____doc__r   r   r   propertyr   r   r   r   r   r   1   sf         / / /
  
$ 
$ 
$   X  r   r   c                    t           j        5  t           j        Rt           j        t           j                                         t           j        | dt           _        n^| t           _        nQ| O| t           j        k    r?| rt          j        t
          j                   nt          j        t
          j                   ddd           n# 1 swxY w Y   t           S )zw
    Returns the manager, but only after ensuring that no other threads are
    attempting to initialize the mode.
    NT)	managerr   r	   r
   waitr   
_raise_errERR_THICK_MODE_ENABLED#ERR_THIN_CONNECTION_ALREADY_CREATED)r
   s    r   get_managerr)   _   s   
 
	 N N$*6!&&((( (&.26G//2EG/+#w'888" N!&"?@@@@!&"LMMM!N N N N N N N N N N N N N N N" Ns   B0C		CCreturnc                  6    t           j        t           j        S dS )u  
    Returns a boolean indicating if python-oracledb is in Thin mode.

    Immediately after python-oracledb is imported, this function will return
    *True* indicating that python-oracledb defaults to Thin mode. If a call to
    :func:`oracledb.init_oracle_client()` returns successfully, then a
    subsequent call to ``is_thin_mode()`` will return False indicating that
    Thick mode is enabled. Once the first standalone connection or connection
    pool is created, or a successful call to ``oracledb.init_oracle_client()``
    is made, or :meth:`oracledb.enable_thin_mode()` is called, then
    python-oracledb’s mode is fixed and the value returned by
    ``is_thin_mode()`` will never change for the lifetime of the process.

    The attribute :attr:`Connection.thin` can be used to check a connection's
    mode. The attribute :attr:`ConnectionPool.thin` can be used to check a
    pool's mode.
    NT)r$   r	   r   r   r   is_thin_moder,   x   s    $ $  4r   r   )r    r   r   r$   r)   boolr,   r   r   r   <module>r/      s   D          ( ( ( ( ( ( ( (V 


   2d      r   