
    iy
                       d 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mZmZ dd
lmZ ddl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 ddlmZ ddl m!Z! ejD                  jF                  Z#ejD                  jH                  Z$ G d deeef         Z% G d de%def   ee         Z& G d de%def   ee         Z'y)z%
psycopg client-side binding cursors
    )annotations)TYPE_CHECKING)partial   )adapt)errors)pq)ConnectionTypeParamsQuery)Row)Cursor)PostgresClientQueryPostgresQuery)Prepare)
BaseCursor)AsyncCursor)Any)
Connection)AsyncConnectionc                  N    e Zd ZeZdddZddd	 	 	 	 	 	 	 d	dZ	 d	 	 	 	 	 d
dZy)ClientCursorMixinNc                    t        j                  |       | _        | j                  ||      }|j                  j                  | j                  j                        S )z
        Return the query and parameters merged.

        Parameters are adapted and merged to the query the same way that
        `!execute()` would do.

        )r   Transformer_tx_convert_queryquerydecodeencoding)selfr   paramspgqs       u/var/www/html/hwPaymentPortal-be-dev/hw-payment-portal-api/venv/lib/python3.12/site-packages/psycopg/client_cursor.pymogrifyzClientCursorMixin.mogrify$   sG     $$T*!!%0yy 1 122    F)force_extendedbinaryc                  || j                   }n|rt        nt        }|t        k(  rt        j                  d      || _        | j                  j                  rY| j                  j                  j                  j                  t        | j                  j                  |j                  d              y |r'| j                  j                  |j                  d        y | j                  j                  |j                         y )Nz0client-side cursors don't support binary results)formatBINARYTEXTeNotSupportedError_query_conn	_pipelinecommand_queueappendr   _pgconnsend_query_paramsr   
send_query)r    r   r&   r'   fmts        r#   _execute_sendzClientCursorMixin._execute_send0   s     >++C"&C&=%%B  :: JJ  ..5566TJ LL**5;;= LL##EKK0r%   c                &    t         j                  dfS )Nr%   )r   NO)r    r"   prepares      r#   _get_preparedzClientCursorMixin._get_preparedP   s     

C  r%   )N)r   r   r!   zParams | Nonereturnstr)r   r   r&   boolr'   bool | Noner<   None)r"   r   r:   r?   r<   ztuple[Prepare, bytes])__name__
__module____qualname__r   
_query_clsr$   r7   r;    r%   r#   r   r   !   sb    $J
3   %"11 	1
 1 
1B :>! !+6!	!r%   r   c                      e Zd ZdZy)ClientCursorpsycopgNrA   rB   rC   rE   r%   r#   rG   rG   V   s    Jr%   rG   zConnection[Any]c                      e Zd ZdZy)AsyncClientCursorrH   NrI   rE   r%   r#   rK   rK   Z   s	     Jr%   rK   zAsyncConnection[Any]N)(__doc__
__future__r   typingr   	functoolsr    r   r   r,   r	   abcr
   r   r   rowsr   cursorr   _queriesr   r   
_preparingr   _cursor_baser   cursor_asyncr   r   
connectionr   connection_asyncr   Formatr+   r*   r   rG   rK   rE   r%   r#   <module>r[      s    #       . .   8  $ %&1	yy~~			2!
>3#67 2!j$%6%;<fSk ,c12K4Dr%   