
    i5,                         d dl mZ d dlZddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZmZmZmZmZ ddlmZ  G d d	e
          ZdS )    )UnionN   )	constants)BaseMetaClass)
DbTypeDB_TYPE_DATEDB_TYPE_TIMESTAMPDB_TYPE_TIMESTAMP_LTZDB_TYPE_TIMESTAMP_TZDB_TYPE_BINARY_FLOATDB_TYPE_BINARY_DOUBLEDB_TYPE_BINARY_INTEGERDB_TYPE_NUMBERDB_TYPE_VECTOR)DbObjectTypec                      e Zd ZdZd Zd Zd Zd Zd Ze	d             Z
edeed	f         fd
            Zedeed	f         fd            Zedeed	f         fd            Zedeed	f         fd            Zedeed	f         fd            Zedefd            Zedefd            Zedefd            Zedefd            Zedeed	f         fd            Zedeed	f         fd            Zedeeef         fd            Zedefd            Zedeed	f         fd            Z edee!j"        d	f         fd            Z#edeed	f         fd            Z$d	S )	FetchInfoz@
    Identifies metadata of columns that are being fetched.
    c                 (    t          |           |k    S N)tuple)selfothers     c/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/oracledb/fetch_info.py__eq__zFetchInfo.__eq__:   s    T{{e##    c                    |dk    s|dk    r| j         S |dk    s|dk    r| j        S |dk    s|dk    r| j        S |dk    s|dk    r| j        S |d	k    s|d
k    r| j        S |dk    s|dk    r| j        S |dk    s|dk    r| j        S t          |t                    r"t          |           
                    |          S t          d          )zG
        Return the parts mandated by the Python Database API.
        r   ir   i               zlist index out of range)name	type_codedisplay_sizeinternal_size	precisionscalenull_ok
isinstanceslicer   __getitem__
IndexError)r   indexs     r   r0   zFetchInfo.__getitem__=   s     A::"9aZZ5B;;>!aZZ5B;;$$aZZ5B;;%%aZZ5B;;>!aZZ5B;;:aZZ5B;;<u%% 	2;;**51112333r   c                     dS )z=
        Length mandated by the Python Database API.
            r   s    r   __len__zFetchInfo.__len__S   s	     qr   c                 :    t          t          |                     S r   )reprr   r6   s    r   __repr__zFetchInfo.__repr__Y   s    E$KK   r   c                 :    t          t          |                     S r   )strr   r6   s    r   __str__zFetchInfo.__str__\   s    5;;r   c                 L    |                      |           }||_        d |_        |S r   )__new___impl_type)clsimplinfos      r   
_from_implzFetchInfo._from_impl_   s&    {{3

r   returnNc                     | j         j        S )a  
        This read-only attribute returns a dictionary containing the
        `annotations <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=
        GUID-1AC16117-BBB6-4435-8794-2B99F8F68052>`__ associated with the
        fetched column. If there are no annotations, the value *None* is
        returned. Annotations require Oracle Database version 23, or later. If
        using python-oracledb Thick mode, Oracle Client version 23 or later is
        also required.
        )r@   annotationsr6   s    r   rH   zFetchInfo.annotationsf   s     z%%r   c                 n   | j         j        dk    r| j         j        S | j         j        }|t          u s|t          u s|t
          u s	|t          u rdS |t          u s|t          u s|t          u s	|t          u rB| j         j        r2| j         j        dz   }| j         j        dk    r|| j         j        dz   z  }nd}|S dS )zR
        This read-only attribute returns the display size of the column.
        r      r      N)r@   max_sizedbtyper   r	   r
   r   r   r   r   r   r+   r,   )r   rM   r)   s      r   r)   zFetchInfo.display_sizes   s    
 :"":&&"l""***...---2***...///''z# ##z3a7:#a'' DJ$4q$88L" ('r   c                     | j         j        S )am  
        This read-only attribute returns the name of the `data use case
        domain
        <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-17D3A9C6
        -D993-4E94-BF6B-CACA56581F41>`__ associated with the fetched column. If
        there is no data use case domain, the value *None* is returned. `Data
        use case domains <https://www.oracle.com/pls/topic/lookup?ctx=dblatest
        &id=GUID-4743FDE1-7C6E-471B-BC9D-442383CCA2F9>`__ require Oracle
        Database version 23, or later. If using python-oracledb Thick mode,
        Oracle Client version 23 or later is also required.
        )r@   domain_namer6   s    r   rO   zFetchInfo.domain_name   s     z%%r   c                     | j         j        S )ag  
        This read-only attribute returns the schema of the `data use case
        domain <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-
        17D3A9C6-D993-4E94-BF6B-CACA56581F41>`__ associated with the fetched
        column. If there is no data use case domain, the value *None* is
        returned. `Data use case domains <https://www.oracle.com/pls/topic/
        lookup?ctx=dblatest&id=GUID-4743FDE1-7C6E-471B-BC9D-442383CCA2F9>`__
        require Oracle Database version 23, or later. If using python-oracledb
        Thick mode, Oracle Client version 23 or later is also required.
        )r@   domain_schemar6   s    r   rQ   zFetchInfo.domain_schema   s     z''r   c                 >    | j         j        dk    r| j         j        S dS )z
        This read-only attribute returns the internal size of the column as
        mandated by the Python Database API.
        r   N)r@   rL   buffer_sizer6   s    r   r*   zFetchInfo.internal_size   s'     :"":)) #"r   c                     | j         j        S )a  
        This read-only attribute returns whether the column is known to contain
        JSON data. This will be *True* when the type code is
        :data:`oracledb.DB_TYPE_JSON` as well as when an "IS JSON" constraint
        is enabled on LOB and VARCHAR2 columns.
        )r@   is_jsonr6   s    r   rU   zFetchInfo.is_json   s     z!!r   c                     | j         j        S )a[  
        This read-only attribute returns whether the column is known to contain
        binary encoded `OSON <https://www.oracle.com/pls/topic/lookup?ctx=
        dblatest&id=GUID-911D302C-CFAF-406B-B6A5-4E99DD38ABAD>`__ data. This
        will be *True* when an "IS JSON FORMAT OSON" check constraint is
        enabled on BLOB columns.
        )r@   is_osonr6   s    r   rW   zFetchInfo.is_oson   s     z!!r   c                     | j         j        S )zy
        This read-only attribute returns the name of the column as mandated by
        the Python Database API.
        )r@   r'   r6   s    r   r'   zFetchInfo.name   s     zr   c                     | j         j        S )z
        This read-only attribute returns whether nulls are allowed in the
        column as mandated by the Python Database API.
        )r@   nulls_allowedr6   s    r   r-   zFetchInfo.null_ok   s     z''r   c                 N    | j         j        s| j         j        r| j         j        S dS )z~
        This read-only attribute returns the precision of the column as
        mandated by the Python Database API.
        Nr@   r+   r,   r6   s    r   r+   zFetchInfo.precision   s2     : 	(4:#3 	(:''	( 	(r   c                 N    | j         j        s| j         j        r| j         j        S dS )zz
        This read-only attribute returns the scale of the column as mandated by
        the Python Database API.
        Nr\   r6   s    r   r,   zFetchInfo.scale   s2     : 	$4:#3 	$:##	$ 	$r   c                     | j         A| j        j        $t          j        | j        j                  | _         n| j        j        | _         | j         S )a)  
        This read-only attribute returns the type of the column. This will be
        an :ref:`Oracle Object Type <dbobjecttype>` if the column contains
        Oracle objects; otherwise, it will be one of the
        :ref:`database type constants <dbtypes>` defined at the module level.
        )rA   r@   objtyper   rE   rM   r6   s    r   typezFetchInfo.type   sD     :z!-)4TZ5GHH

!Z.
zr   c                     | j         j        S )z
        This read-only attribute returns the type of the column as mandated by
        the Python Database API. The type will be one of the
        :ref:`database type constants <dbtypes>` defined at the module level.
        )r@   rM   r6   s    r   r(   zFetchInfo.type_code   s     z  r   c                 ~    | j         j        t          u r'| j         j        }|t          j        z  s| j         j        S dS dS )z
        This read-only attribute returns the number of dimensions required by
        VECTOR columns. If the column is not a VECTOR column or allows for any
        number of dimensions, the value returned is *None*.
        N)r@   rM   r   vector_flagsr   VECTOR_META_FLAG_FLEXIBLE_DIMvector_dimensionsr   flagss     r   re   zFetchInfo.vector_dimensions  sK     :..J+EICC 4z33 /.4 4r   c                     | j         j        t          u r.| j         j        dk    r t	          j        | j         j                  S dS dS )a  
        This read-only attribute returns the storage type used by VECTOR
        columns. The value of this attribute can be:

        - :data:`oracledb.VECTOR_FORMAT_BINARY` which represents 8-bit unsigned
          integers
        - :data:`oracledb.VECTOR_FORMAT_INT8` which represents 8-bit signed
          integers
        - :data:`oracledb.VECTOR_FORMAT_FLOAT32` which represents 32-bit
          floating-point numbers
        - :data:`oracledb.VECTOR_FORMAT_FLOAT64` which represents 64-bit
          floating-point numbers

        If the column is not a VECTOR column or allows for any type of storage,
        the value returned is *None*.
        r   N)r@   rM   r   vector_formatoracledbVectorFormatr6   s    r   ri   zFetchInfo.vector_format  sH    & J//
(A--()ABBB 0/--r   c                 |    | j         j        t          u r(| j         j        }t	          |t
          j        z            S dS )ap  
        This read-only attribute returns a boolean indicating if the vector is
        sparse or not.

        If the column contains vectors that are SPARSE, the value returned is
        *True*. If the column contains vectors that are DENSE, the value
        returned is *False*. If the column is not a VECTOR column, the value
        returned is *None*.
        N)r@   rM   r   rc   boolr   VECTOR_META_FLAG_SPARSE_VECTORrf   s     r   vector_is_sparsezFetchInfo.vector_is_sparse)  s<     :..J+E	 HHIII /.r   )%__name__
__module____qualname____doc__r   r0   r7   r:   r=   classmethodrE   propertyr   dictrH   intr)   r<   rO   rQ   r*   rm   rU   rW   r'   r-   r+   r,   r   r   r`   r(   re   rj   rk   ri   ro   r5   r   r   r   r   5   sh        $ $ $4 4 4,  ! ! !        [ 
&U4:. 
& 
& 
& X
&  eCI.       X 8 &U39- & & & X& (uS$Y/ ( ( ( X( *uS$Y/ * * * X* " " " " X" " " " " X" c    X ( ( ( ( X( (5d+ ( ( ( X( $uS$Y' $ $ $ X$ eFL01    X !6 ! ! ! X! 	45d#3 	4 	4 	4 X	4 CuX%:D%@A C C C XC. J%d
"3 J J J XJ J Jr   r   )	metaclass)typingr   rj    r   baser   	base_implr   r   r	   r
   r   r   r   r   r   r   dbobjectr   r   r5   r   r   <module>r~      s"  @                                           # " " " " "AJ AJ AJ AJ AJ- AJ AJ AJ AJ AJ AJr   