o
    NK&h                     @   sR   d dl Z d dlmZmZ d dlmZmZmZmZ er ddl	m
Z
 G dd dZdS )    N)AsyncIteratorIterable)AnyCallableOptionalTYPE_CHECKING   )
Connectionc                   @   s  e Zd ZdddejddfddZdeej fdd	Zd
d Z	dd Z
	d5dedeee  dd fddZdedeee  dd fddZdedd fddZdeej fddZd5dee deej fddZdeej fddZd6ddZedefd d!Zedee fd"d#Zedefd$d%Zejd&eddfd'd%Zedeeeddddddf d(f fd)d*Zedeeejejgef  fd+d,Z e jd-ee! ddfd.d,Z edej"fd/d0Z#d1d2 Z$d3d4 Z%dS )7Cursorconnr	   cursorreturnNc                 C   s   |j | _|| _|| _d S N)_iter_chunk_sizeiter_chunk_size_conn_cursor)selfr   r    r   C/var/www/html/venv/lib/python3.10/site-packages/aiosqlite/cursor.py__init__   s   
zCursor.__init__c                 C   s   |   S )z+The cursor proxy is also an async iterator.)_fetch_chunkedr   r   r   r   	__aiter__      zCursor.__aiter__c                 C  s0   	 |  | jI d H }|sd S |D ]}|V  qqr   )	fetchmanyr   )r   rowsrowr   r   r   r      s   zCursor._fetch_chunkedc                    s"   | j j|g|R i |I dH S )z=Execute the given function on the shared connection's thread.N)r   _execute)r   fnargskwargsr   r   r   r      s    zCursor._executesql
parametersc                    s*   |du rg }|  | jj||I dH  | S )zExecute the given query.N)r   r   executer   r"   r#   r   r   r   r$   "   s
   zCursor.executec                    s   |  | jj||I dH  | S )zExecute the given multiquery.N)r   r   executemanyr%   r   r   r   r&   +   s   zCursor.executemany
sql_scriptc                    s   |  | jj|I dH  | S )zExecute a user script.N)r   r   executescript)r   r'   r   r   r   r(   2   s   zCursor.executescriptc                       |  | jjI dH S )zFetch a single row.N)r   r   fetchoner   r   r   r   r*   7      zCursor.fetchonesizec                    s0   d}|dur
|f}| j | jjg|R  I dH S )z.Fetch up to `cursor.arraysize` number of rows.r   N)r   r   r   )r   r,   r    r   r   r   r   ;   s
   zCursor.fetchmanyc                    r)   )zFetch all remaining rows.N)r   r   fetchallr   r   r   r   r-   B   r+   zCursor.fetchallc                    s   |  | jjI dH  dS )zClose the cursor.N)r   r   closer   r   r   r   r.   F   s   zCursor.closec                 C      | j jS r   )r   rowcountr   r   r   r   r0   J   r   zCursor.rowcountc                 C   r/   r   )r   	lastrowidr   r   r   r   r1   N   r   zCursor.lastrowidc                 C   r/   r   r   	arraysizer   r   r   r   r3   R   r   zCursor.arraysizevaluec                 C      || j _d S r   r2   )r   r4   r   r   r   r3   V      .c                 C   r/   r   )r   descriptionr   r   r   r   r7   Z   r   zCursor.descriptionc                 C   r/   r   r   row_factoryr   r   r   r   r9   ^   r   zCursor.row_factoryfactoryc                 C   r5   r   r8   )r   r:   r   r   r   r9   b   r6   c                 C   r/   r   )r   
connectionr   r   r   r   r;   f   r   zCursor.connectionc                    s   | S r   r   r   r   r   r   
__aenter__j   s   zCursor.__aenter__c                    s   |   I d H  d S r   )r.   )r   exc_typeexc_valexc_tbr   r   r   	__aexit__m   s   zCursor.__aexit__r   )r   N)&__name__
__module____qualname__sqlite3r
   r   r   Rowr   r   r   strr   r   r   r$   r&   r(   r*   intr   r-   r.   propertyr0   r1   r3   settertupler7   r   objectr9   typer	   r;   r<   r@   r   r   r   r   r
      sV    

	


*$r
   )rD   collections.abcr   r   typingr   r   r   r   corer	   r
   r   r   r   r   <module>   s   