
    iF                         d dl mZmZmZmZ ddlmZ ddlmZ ddl	m
Z
mZmZ ddlmZ ddlmZ ddlmZ dd	lmZ  G d
 de          Z G d de          Z G d de          ZdefdZdS )    )AnyCallableOptionalUnion   )utils)BaseMetaClass)PipelineImplPipelineOpImplPipelineOpResultImpl)defaults)PipelineOpType)_Error)	FetchInfoc                   ~   e Zd Zd Z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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dS )
PipelineOpc                 @    | j         j        }d| d| j        j         dS )N<z	 of type >)	__class___public_nameop_typenameselfcls_names     a/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/oracledb/pipeline.py__repr__zPipelineOp.__repr__,   s*    >.:8::dl&7::::    c                     t          | j                  }t                              t                    }| |_        ||_        |S )zu
        Internal method used for creating a result object that is returned when
        running a pipeline.
        )r   _implPipelineOpResult__new__
_operation)r   implresults      r   _create_resultzPipelineOp._create_result0   s;    
 $DJ//!))*:;; r   returnc                     | j         j        S )z
        This read-only attribute returns the array size that will be used when
        fetching query rows with :meth:`Pipeline.add_fetchall()`. For all other
        operations, the value returned is *0*.
        )r!   	arraysizer   s    r   r*   zPipelineOp.arraysize;   s     z##r   c                     | j         j        S )z
        Returns whether or not to fetch columns of type ``NUMBER`` as
        ``decimal.Decimal`` values for a query.
        )r!   fetch_decimalsr+   s    r   r-   zPipelineOp.fetch_decimalsD   s     z((r   c                     | j         j        S )zK
        Returns whether or not to fetch LOB locators for a query.
        )r!   
fetch_lobsr+   s    r   r/   zPipelineOp.fetch_lobsL   s    
 z$$r   c                     | j         j        S )z
        This read-only attribute returns the keyword parameters to the stored
        procedure or function being called by the operation, if applicable.
        )r!   keyword_parametersr+   s    r   r1   zPipelineOp.keyword_parametersS   s     z,,r   Nc                     | j         j        S )z
        This read-only attribute returns the name of the stored procedure or
        function being called by the operation, if applicable.
        )r!   r   r+   s    r   r   zPipelineOp.name[        zr   c                     | j         j        S )z
        This read-only attribute returns the number of rows to fetch when
        performing a query of a specific number of rows. For all other
        operations, the value returned is *0*.
        )r!   num_rowsr+   s    r   r5   zPipelineOp.num_rowsc   s     z""r   c                 4    t          | j        j                  S )zf
        This read-only attribute returns the type of operation that is taking
        place.
        )r   r!   r   r+   s    r   r   zPipelineOp.op_typel   s     dj0111r   c                     | j         j        S )z
        This read-only attribute returns the parameters to the stored procedure
        or function or the parameters bound to the statement being executed by
        the operation, if applicable.
        )r!   
parametersr+   s    r   r8   zPipelineOp.parameterst   s     z$$r   c                     | j         j        S )z
        This read-only attribute returns the return type of the stored function
        being called by the operation, if applicable.
        )r!   return_typer+   s    r   r:   zPipelineOp.return_type}   s     z%%r   c                     | j         j        S )z
        This read-only attribute returns the row factory callable function to
        be used in a query executed by the operation, if applicable.
        )r!   
rowfactoryr+   s    r   r<   zPipelineOp.rowfactory   s     z$$r   c                     | j         j        S )zx
        This read-only attribute returns the statement being executed by the
        operation, if applicable.
        )r!   	statementr+   s    r   r>   zPipelineOp.statement   s     z##r   )__name__
__module____qualname__r   r'   propertyintr*   boolr-   r/   r   r1   r   strr   r5   r   r   r8   r:   r   r<   r>    r   r   r   r   *   s       ; ; ;	 	 	 $3 $ $ $ X$ ) ) ) ) X) %D % % % X% -C - - - X- eCI&    X ## # # # X# 2 2 2 2 X2 %C % % % X% &S & & & X& %E(D.1 % % % X% $5d+ $ $ $ X$ $ $r   r   )	metaclassc                      e Zd Zd Zede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edf         fd            Zedee	df         fd	            ZdS )
r"   c                 J    | j         j        }d| d| j        j        j         dS )Nr   z for operation of type r   )r   r   	operationr   r   r   s     r   r   zPipelineOpResult.__repr__   s/    >.OOO1G1LOOO	
r   r(   Nc                 J    | j         j        d | j         j        D             S dS )z
        This read-only attribute is a list of FetchInfo objects. This
        attribute will be *None* for operations that do not return rows.
        Nc                 6    g | ]}t          j        |          S rF   )r   
_from_impl).0is     r   
<listcomp>z,PipelineOpResult.columns.<locals>.<listcomp>   s#    OOOI(++OOOr   )r!   fetch_metadatar+   s    r   columnszPipelineOpResult.columns   s0     :$0OOTZ5NOOOO 10r   c                     | j         j        S )z
        This read-only attribute returns the error that occurred when running
        this operation. If no error occurred, then the value *None* is
        returned.
        )r!   errorr+   s    r   rT   zPipelineOpResult.error   s     zr   c                     | j         S )zu
        This read-only attribute returns the PipelineOp operation object that
        generated the result.
        )r$   r+   s    r   rJ   zPipelineOpResult.operation   s     r   c                     | j         j        S )z
        This read-only attribute returns the return value of the called PL/SQL
        function, if a function was called for the operation.
        )r!   return_valuer+   s    r   rW   zPipelineOpResult.return_value   s     z&&r   c                     | j         j        S )z
        This read-only attribute returns the rows that were fetched by the
        operation, if a query was executed.
        )r!   rowsr+   s    r   rY   zPipelineOpResult.rows   r3   r   c                     | j         j        S )z
        This read-only attribute returns any warning that was encountered when
        running this operation. If no warning was encountered, then the value
        *None* is returned.
        )r!   warningr+   s    r   r[   zPipelineOpResult.warning   s     z!!r   )r?   r@   rA   r   rB   r   listr   rR   r   rT   r   rJ   r   rW   rY   r[   rF   r   r   r"   r"      s;       
 
 
 PtI45 P P P XP  uVT\*       X  :    X 'c ' ' ' X' eD$J'    X "vt|, " " " X" " "r   r"   c                      e Zd Zd Zd Z	 	 ddededeee	e
f                  dee         def
d	Z	 	 ddedeee	e
f                  dee         defd
ZdefdZ	 ddedeee	e
ef                  defdZdedee	ef         defdZ	 	 	 	 	 ddedeee	e
ef                  dee         dee         dee         dee         defdZ	 	 	 	 	 ddedeee	e
ef                  dee         dee         dee         dee         defdZ	 	 	 	 ddedeee	e
ef                  dee         dee         dee         defdZede	e         fd            ZdS )Pipelinec                 Z    | j         j        }d| dt          | j        j                   dS )Nr   z with z operations>)r   r   lenr!   
operationsr   s     r   r   zPipeline.__repr__   s2    >.K8KK3tz'<#=#=KKKKr   c                     | j         j                            |           t                              t                    }||_         | j                            |           |S )z
        Internal method for adding an PipelineOpImpl instance to the list of
        operations, creating an associated PipelineOp instance to correspond to
        it.
        )r!   ra   appendr   r#   _operations)r   op_implops      r   _add_opzPipeline._add_op   sS     	
$$W---
++###	r   Nr   r:   r8   r1   r(   c                     t          j        ||           t          t          j        ||||          }|                     |          S )a  
        Adds an operation to the pipeline that calls a stored PL/SQL function
        with the given parameters and return type. The created PipelineOp
        object is also returned from this function.

        When the Pipeline is executed, the PipelineOpResult object that is
        returned for this operation will have the
        :attr:`~PipelineOpResult.return_value` attribute populated with the
        return value of the PL/SQL function if the call completes
        successfully.
        )r   r   r:   r8   r1   )r   verify_stored_proc_argsr   r   	CALL_FUNCrg   )r   r   r:   r8   r1   re   s         r   add_callfunczPipeline.add_callfunc   sR    $ 	%j2DEEE ",#!1
 
 
 ||G$$$r   c                     t          j        ||           t          t          j        |||          }|                     |          S )z
        Adds an operation that calls a stored procedure with the given
        parameters. The created PipelineOp object is also returned from
        this function.
        )r   r   r8   r1   )r   ri   r   r   	CALL_PROCrg   )r   r   r8   r1   re   s        r   add_callproczPipeline.add_callproc   sO     	%j2DEEE ",!1	
 
 
 ||G$$$r   c                 `    t          t          j                  }|                     |          S )z;
        Adds an operation that performs a commit.
        )r   )r   r   COMMITrg   )r   re   s     r   
add_commitzPipeline.add_commit  s)     !)>???||G$$$r   r>   c                 d    t          t          j        ||          }|                     |          S )a^  
        Adds an operation that executes a statement with the given parameters.
        The created PipelineOp object is also returned from this function.

        Do not use this for queries that return rows.  Instead use
        :meth:`Pipeline.add_fetchall()`, :meth:`Pipeline.add_fetchmany()`, or
        :meth:`Pipeline.add_fetchone()`.
        r   r>   r8   )r   r   EXECUTErg   r   r>   r8   re   s       r   add_executezPipeline.add_execute  s8     !"*!
 
 

 ||G$$$r   c                 d    t          t          j        ||          }|                     |          S )a/  
        Adds an operation that executes a SQL statement once using all bind
        value mappings or sequences found in the sequence parameters. This can
        be used to insert, update, or delete multiple rows in a table. It can
        also invoke a PL/SQL procedure multiple times.

        The created PipelineOp object is also returned from this function.

        The ``parameters`` parameter can be a list of tuples, where each tuple
        item maps to one bind variable placeholder in ``statement``. It can
        also be a list of dictionaries, where the keys match the bind variable
        placeholder names in ``statement``. If there are no bind values, or
        values have previously been bound, the ``parameters`` value can be an
        integer specifying the number of iterations.
        rs   )r   r   EXECUTE_MANYrg   ru   s       r   add_executemanyzPipeline.add_executemany/  s8    ( !"/!
 
 

 ||G$$$r   r*   r<   r/   r-   c           	          |t           j        }t          t          j        ||||||          }|                     |          S )a  
        Adds an operation that executes a query and returns all of the rows
        from the result set.  The created PipelineOp object is also returned
        from this function.

        When the Pipeline is executed, the PipelineOpResult object that is
        returned for this operation will have the
        :attr:`~PipelineOpResult.rows` attribute populated with the list of
        rows returned by the query.

        The default value for ``arraysize`` is
        :attr:`oracledb.defaults.arraysize <Defaults.arraysize>`.

        Internally, this operation's :attr:`Cursor.prefetchrows` size is set
        to the value of the explicit or default ``arraysize`` parameter value.

        The ``fetch_lobs`` parameter specifies whether to return LOB locators
        or ``str``/``bytes`` values when fetching LOB columns. The default
        value is :data:`oracledb.defaults.fetch_lobs <Defaults.fetch_lobs>`.

        The ``fetch_decimals`` parameter specifies whether to return
        ``decimal.Decimal`` values when fetching columns of type ``NUMBER``.
        The default value is
        :data:`oracledb.defaults.fetch_decimals <Defaults.fetch_decimals>`.
        N)r   r>   r8   r*   r<   r/   r-   )r   r*   r   r   	FETCH_ALLrg   )r   r>   r8   r*   r<   r/   r-   re   s           r   add_fetchallzPipeline.add_fetchallJ  sS    D  *I ",!!!)
 
 
 ||G$$$r   r5   c           	          |t           j        }t          t          j        ||||||          }|                     |          S )a  
        Adds an operation that executes a query and returns up to the specified
        number of rows from the result set.  The created PipelineOp object is
        also returned from this function.

        When the Pipeline is executed, the PipelineOpResult object that is
        returned for this operation will have the
        :attr:`~PipelineOpResult.rows` attribute populated with the list of
        rows returned by the query.

        The default value for ``num_rows`` is the value of
        :attr:`oracledb.defaults.arraysize <Defaults.arraysize>`.

        Internally, this operation's :attr:`Cursor.prefetchrows` size is set to
        the value of the explicit or default ``num_rows`` parameter, allowing
        all rows to be fetched in one round-trip.

        Since only one fetch is performed for a query operation, consider
        adding a ``FETCH NEXT`` clause to the statement to prevent the
        database processing rows that will never be fetched.

        The ``fetch_lobs`` parameter specifies whether to return LOB locators
        or ``str``/``bytes`` values when fetching LOB columns. The default
        value is :data:`oracledb.defaults.fetch_lobs <Defaults.fetch_lobs>`.

        The ``fetch_decimals`` parameter specifies whether to return
        ``decimal.Decimal`` values when fetching columns of type ``NUMBER``.
        The default value is
        :data:`oracledb.defaults.fetch_decimals <Defaults.fetch_decimals>`.
        N)r   r>   r8   r5   r<   r/   r-   )r   r*   r   r   
FETCH_MANYrg   )r   r>   r8   r5   r<   r/   r-   re   s           r   add_fetchmanyzPipeline.add_fetchmanyy  sS    N )H "-!!!)
 
 
 ||G$$$r   c                 j    t          t          j        |||||          }|                     |          S )a7  
        Adds an operation that executes a query and returns the first row of
        the result set if one exists (or *None*, if no rows exist).  The
        created PipelineOp object is also returned from this function.

        When the Pipeline is executed, the PipelineOpResult object that is
        returned for this operation will have the
        :attr:`~PipelineOpResult.rows` attribute populated with this row if the
        query is performed successfully.

        Internally, this operation's :attr:`Cursor.prefetchrows` and
        :attr:`Cursor.arraysize` sizes will be set to *1*.

        Since only one fetch is performed for a query operation, consider
        adding a ``WHERE`` condition or using a ``FETCH NEXT`` clause in the
        statement to prevent the database processing rows that will never be
        fetched.

        The ``fetch_lobs`` parameter specifies whether to return LOB locators
        or ``str``/``bytes`` values when fetching LOB columns. The default
        value is :data:`oracledb.defaults.fetch_lobs <Defaults.fetch_lobs>`.

        The ``fetch_decimals`` parameter specifies whether to return
        ``decimal.Decimal`` values when fetching columns of type ``NUMBER``.
        The default value is
        :data:`oracledb.defaults.fetch_decimals <Defaults.fetch_decimals>`.
        )r   r>   r8   r<   r/   r-   )r   r   	FETCH_ONErg   )r   r>   r8   r<   r/   r-   re   s          r   add_fetchonezPipeline.add_fetchone  sB    F !",!!!)
 
 
 ||G$$$r   c                     | j         S )zo
        This read-only attribute returns the list of operations associated with
        the pipeline.
        )rd   r+   s    r   ra   zPipeline.operations  s     r   )NN)N)NNNNN)NNNN)r?   r@   rA   r   rg   rE   r   r   r   r\   tupledictr   rk   rn   rq   rv   rC   ry   r   rD   r|   r   r   rB   ra   rF   r   r   r^   r^      s^       L L L
 
 
  48-1% %% % U4;/0	%
 %TN% 
% % % %> 48-1	% %% U4;/0% %TN	%
 
% % % %(%J % % % % :>% %% U4#456% 
	% % % %(%% $)$% 
	% % % %< :>#')-%))--% -%-% U4#456-% C=	-%
 X&-% TN-% !-% 
-% -% -% -%d :>"&)-%))-2% 2%2% U4#4562% 3-	2%
 X&2% TN2% !2% 
2% 2% 2% 2%n :>)-%))-+% +%+% U4#456+% X&	+%
 TN+% !+% 
+% +% +% +%Z  D,       X     r   r^   r(   c                  x    t                               t                     } t                      | _        g | _        | S )zl
    Creates a pipeline object which can be used to process a set of operations
    against a database.
    )r^   r#   r
   r!   rd   )pipelines    r   create_pipeliner     s/    
 ))H!^^HNHOr   N)typingr   r   r   r    r   baser	   	base_implr
   r   r   r   enumsr   errorsr   
fetch_infor   r   r"   r^   r   rF   r   r   <module>r      s|  > 2 1 1 1 1 1 1 1 1 1 1 1             I I I I I I I I I I       ! ! ! ! ! !       ! ! ! ! ! !i$ i$ i$ i$ i$= i$ i$ i$ i$X9" 9" 9" 9" 9" 9" 9" 9" 9"xN  N  N  N  N  N  N  N  N b      r   