
    gi                        d Z ddlmZ ddlmZmZmZ ddlmZm	Z	 ddl
mZ ddlmZmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ erddlmZ  G d dedef         ee                   ZdS )z%
psycopg server-side cursor (async).
    )annotations)TYPE_CHECKINGAnyoverload)AsyncIteratorIterable   )errors)ParamsQuery)AsyncRowFactoryRow)Self)AsyncCursor)ServerCursorMixin)AsyncConnectionc                       e Zd ZdZdZedddd7d            Zedddd8d            Zddddd9dZd: fdZ	 d;ddd<d"Zd#d$d=d(Zd>d*Z	d?d@d/Z
dAd0ZdBd2ZdCdDd6Z xZS )EAsyncServerCursorpsycopg NF)
scrollablewithhold
connectionAsyncConnection[Row]namestrr   bool | Noner   boolc                   d S Nr   )selfr   r   r   r   s        l/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/psycopg/_server_cursor_async.py__init__zAsyncServerCursor.__init__   s	     s    AsyncConnection[Any]row_factoryAsyncRowFactory[Row]c                   d S r    r   r!   r   r   r&   r   r   s         r"   r#   zAsyncServerCursor.__init__'   s	     sr$   )r&   r   r   AsyncRowFactory[Row] | Nonec               p    t          j        | ||p|j                   t          j        | |||           d S )N)r&   )r   r#   r&   r   r)   s         r"   r#   zAsyncServerCursor.__init__2   sL     	*+*O9O	
 	
 	
 	
 	"4z8DDDDDr$   returnNonec                x  K   | j         j        4 d{V  | j        r	 ddd          d{V  dS | j         j        s2| j                             |                                            d{V  t                                                       d{V  ddd          d{V  dS # 1 d{V swxY w Y   dS )zI
        Close the current cursor and free associated resources.
        N)_connlockclosedwait
_close_gensuperclose)r!   	__class__s    r"   r5   zAsyncServerCursor.close@   s      :? 	" 	" 	" 	" 	" 	" 	" 	"{ 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" :$ 9joodoo&7&7888888888''--//!!!!!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s   	B)A$B))
B36B3)binaryqueryr   paramsParams | Noner7   kwargsr   r   c                 K   |r%t          dt          |          d                    | j        j        rt	          j        d          	 | j        j        4 d{V  | j                            | 	                    |||                     d{V  ddd          d{V  n# 1 d{V swxY w Y   n,# t          j
        $ r}|                    d          d}~ww xY w| S )zC
        Open a cursor to execute a query to the database.
        zkeyword not supported: r   z2server-side cursors not supported in pipeline modeN)	TypeErrorlist_pgconnpipeline_statuseNotSupportedErrorr/   r0   r2   _declare_gen_NO_TRACEBACKwith_traceback)r!   r8   r9   r7   r;   exs         r"   executezAsyncServerCursor.executeK   s       	IGd6ll1oGGHHH<' 	%D  	*z P P P P P P P Pjood&7&7vv&N&NOOOOOOOOOP P P P P P P P P P P P P P P P P P P P P P P P P P P 	* 	* 	*##D)))	* s<   B7 6B%B7 %
B//B7 2B/3B7 7C CC T)	returning
params_seqIterable[Params]rH   c               .   K   t          j        d          )z/Method not implemented for server-side cursors.z0executemany not supported on server-side cursors)rA   rB   )r!   r8   rI   rH   s       r"   executemanyzAsyncServerCursor.executemanye   s       !"TUUUr$   
Row | Nonec                  K   | j         j        4 d {V  | j                             |                     d                     d {V }d d d           d {V  n# 1 d {V swxY w Y   |r| xj        dz  c_        |d         S d S )Nr	   r   )r/   r0   r2   
_fetch_gen_posr!   recss     r"   fetchonezAsyncServerCursor.fetchonek   s     :? 	= 	= 	= 	= 	= 	= 	= 	=););<<<<<<<<D	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	IINII7N4   4A
A%(A%r   sizeint	list[Row]c                (  K   |s| j         }| j        j        4 d {V  | j                            |                     |                     d {V }d d d           d {V  n# 1 d {V swxY w Y   | xj        t          |          z  c_        |S r    )	arraysizer/   r0   r2   rO   rP   len)r!   rU   rR   s      r"   	fetchmanyzAsyncServerCursor.fetchmanyt   s=      	">D:? 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@)>)>????????D	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@		SYY		s   4A$$
A.1A.c                  K   | j         j        4 d {V  | j                             |                     d                      d {V }d d d           d {V  n# 1 d {V swxY w Y   | xj        t          |          z  c_        |S r    )r/   r0   r2   rO   rP   rZ   rQ   s     r"   fetchallzAsyncServerCursor.fetchall|   s.     :? 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@)>)>????????D	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@		SYY		rT   AsyncIterator[Row]c               N  K   	 | j         j        4 d {V  | j                             |                     | j                             d {V }d d d           d {V  n# 1 d {V swxY w Y   |D ]}| xj        dz  c_        |W V  t          |          | j        k     rd S )NTr	   )r/   r0   r2   rO   itersizerP   rZ   )r!   rR   recs      r"   	__aiter__zAsyncServerCursor.__aiter__   sb     	z M M M M M M M M!Z__T__T]-K-KLLLLLLLLM M M M M M M M M M M M M M M M M M M M M M M M M M M  		Q							4yy4=((	s   9A!!
A+.A+relativevaluemodec                  K   | j         j        4 d {V  | j                             |                     ||                     d {V  d d d           d {V  n# 1 d {V swxY w Y   |dk    r| xj        |z  c_        d S || _        d S )Nrc   )r/   r0   r2   _scroll_genrP   )r!   rd   re   s      r"   scrollzAsyncServerCursor.scroll   sD     :? 	A 	A 	A 	A 	A 	A 	A 	A*//$"2"25$"?"?@@@@@@@@@	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A :IIIIIIDIIIs   5A
A&)A&)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   r   r   )r,   r-   r    )
r8   r   r9   r:   r7   r   r;   r   r,   r   )r8   r   rI   rJ   rH   r   r,   r-   )r,   rM   )r   )rU   rV   r,   rW   )r,   rW   )r,   r^   )rc   )rd   rV   re   r   r,   r-   )__name__
__module____qualname__	__slots__r   r#   r5   rG   rL   rS   r[   r]   rb   rh   __classcell__)r6   s   @r"   r   r      s        JI #'     X  #'     X 48"&E E E E E E	" 	" 	" 	" 	" 	" !%
 #     6 PTV V V V V V                     r$   r   r%   N)__doc__
__future__r   typingr   r   r   collections.abcr   r    r
   rA   abcr   r   rowsr   r   _compatr   cursor_asyncr   _server_cursor_baser   connection_asyncr   r   r   r$   r"   <module>ry      s<    # " " " " " / / / / / / / / / / 3 3 3 3 3 3 3 3               & & & & & & & &       % % % % % % 2 2 2 2 2 2 2111111| | | | |,c12K4D| | | | |r$   