
    g                     X    d dl Z d dlmZmZmZmZmZmZmZm	Z	 e	rddl
mZ  G d d      Zy)    N)AnyAsyncIteratorCallableIterableOptionalTupleTypeTYPE_CHECKING   )
Connectionc                      e Zd Zdddej                  ddfdZdeej                     fdZd Z	d	 Z
	 d"d
edeee      dd fdZd
edeee      dd fdZdedd fdZdeej                     fdZd"dee   deej                     fdZdeej                     fdZd#dZedefd       Zedee   fd       Zedefd       Zej6                  deddfd       Zedeeeddddddf   df   fd       Zedeeej                  ej                  gef      fd       Z e j6                  dee!   ddfd       Z edejD                  fd       Z#d  Z$d! Z%y)$Cursorconnr   cursorreturnNc                 B    |j                   | _        || _        || _        y N)_iter_chunk_sizeiter_chunk_size_conn_cursor)selfr   r   s      E/var/www/openai/venv/lib/python3.12/site-packages/aiosqlite/cursor.py__init__zCursor.__init__   s    #44
    c                 "    | j                         S )z+The cursor proxy is also an async iterator.)_fetch_chunkedr   s    r   	__aiter__zCursor.__aiter__   s    ""$$r   c                v   K   	 | j                  | j                         d {   }|sy |D ]  }| 	 37 wr   )	fetchmanyr   )r   rowsrows      r   r   zCursor._fetch_chunked   s=     (<(<==D	 	 =s    979c                 ^   K    | j                   j                  |g|i | d{   S 7 w)z=Execute the given function on the shared connection's thread.N)r   _execute)r   fnargskwargss       r   r%   zCursor._execute&   s-     (TZZ((=d=f====s   $-+-sql
parametersc                 x   K   |g }| j                  | j                  j                  ||       d{    | S 7 w)zExecute the given query.N)r%   r   executer   r)   r*   s      r   r,   zCursor.execute*   s>      JmmDLL00#zBBB 	Cs   /:8:c                 p   K   | j                  | j                  j                  ||       d{    | S 7 w)zExecute the given multiquery.N)r%   r   executemanyr-   s      r   r/   zCursor.executemany3   s3      mmDLL44c:FFF 	Gs   +646
sql_scriptc                 n   K   | j                  | j                  j                  |       d{    | S 7 w)zExecute a user script.N)r%   r   executescript)r   r0   s     r   r2   zCursor.executescript:   s/     mmDLL66
CCC 	Ds   *535c                 h   K   | j                  | j                  j                         d{   S 7 w)zFetch a single row.N)r%   r   fetchoner   s    r   r4   zCursor.fetchone?   %     ]]4<<#8#89999   )202sizec                 z   K   d}||f} | j                   | j                  j                  g|  d{   S 7 w)z.Fetch up to `cursor.arraysize` number of rows. N)r%   r   r!   )r   r7   r'   s      r   r!   zCursor.fetchmanyC   s>      "7D"T]]4<<#9#9ADAAAAs   2;9;c                 h   K   | j                  | j                  j                         d{   S 7 w)zFetch all remaining rows.N)r%   r   fetchallr   s    r   r;   zCursor.fetchallJ   r5   r6   c                 j   K   | j                  | j                  j                         d{    y7 w)zClose the cursor.N)r%   r   closer   s    r   r=   zCursor.closeN   s"     mmDLL..///s   )313c                 .    | j                   j                  S r   )r   rowcountr   s    r   r?   zCursor.rowcountR   s    ||$$$r   c                 .    | j                   j                  S r   )r   	lastrowidr   s    r   rA   zCursor.lastrowidV       ||%%%r   c                 .    | j                   j                  S r   r   	arraysizer   s    r   rE   zCursor.arraysizeZ   rB   r   valuec                 &    || j                   _        y r   rD   )r   rF   s     r   rE   zCursor.arraysize^   s    !&r   .c                 .    | j                   j                  S r   )r   descriptionr   s    r   rI   zCursor.descriptionb       ||'''r   c                 .    | j                   j                  S r   r   row_factoryr   s    r   rM   zCursor.row_factoryf   rJ   r   factoryc                 &    || j                   _        y r   rL   )r   rN   s     r   rM   zCursor.row_factoryj   s    #* r   c                 .    | j                   j                  S r   )r   
connectionr   s    r   rQ   zCursor.connectionn   s    ||&&&r   c                    K   | S wr   r9   r   s    r   
__aenter__zCursor.__aenter__r   s     s   c                 @   K   | j                          d {    y 7 wr   )r=   )r   exc_typeexc_valexc_tbs       r   	__aexit__zCursor.__aexit__u   s     jjls   r   )r   N)&__name__
__module____qualname__sqlite3r   r   r   Rowr   r   r%   strr   r   r   r,   r/   r2   r4   intr!   r;   r=   propertyr?   rA   rE   setterr   rI   r   objectrM   r	   r   rQ   rS   rX   r9   r   r   r   r      s;   \ 7>> d 
%=5 %>
 ?C$,Xc]$;	$,Xc]$;	c h 
: 5 :BHSM BXgkk=R B: 5 :0 %# % % &8C= & & &3 & & 's 't ' ' (U5dD$dD)P#QSV#VW ( ( (Xh/Lf/T&UV ( ( +8D> +d + + 'G.. ' 'r   r   )r\   typingr   r   r   r   r   r   r	   r
   corer   r   r9   r   r   <module>re      s-    	 	 	  b br   