
    ,how                   j   d Z ddlmZ g dZddlZddlZddlZddl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mZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& d
dl'm(Z( d
dl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 d
dl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z; d
dl<m=Z=m>Z> d
dl?m@Z@mAZAmBZBmCZCmDZD d
dlEmFZFmGZG d
dlmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZS d
dlTmUZUmVZV ddlWmXZX ddlYmZZZmYZY ddl[m\Z\ erddl]m^Z^m_Z_ ej                  dk(  Zae G d d             Zb G d de	      Zc G d de	      Zd G d d eU      Zey)!z+Module gathering all abstract base classes.    )annotations)MySQLConnectionAbstractMySQLCursorAbstract
ServerInfoN)ABCabstractmethod)	dataclassfield)	signature)TracebackType)TYPE_CHECKINGAnyAsyncGenerator	AwaitableBinaryIOCallableClassVarDequeDict	GeneratorIteratorListMappingNoReturnOptionalSequenceTupleTypeUnioncast   )
deprecated)DUPLICATED_IN_LIST_ERRORKRB_SERVICE_PRINCIPAL_ERRORMYSQL_PY_TYPESOPENID_TOKEN_FILE_ERRORTLS_V1_3_SUPPORTEDTLS_VER_NO_SUPPORTEDTLS_VERSION_ERRORTLS_VERSION_UNACCEPTABLE_ERROR)	CONN_ATTRS_DNDEFAULT_CONFIGURATIONDEPRECATED_METHOD_WARNINGMYSQL_DEFAULT_CHARSET_ID_57MYSQL_DEFAULT_CHARSET_ID_80OPENSSL_CS_NAMESTLS_CIPHER_SUITESTLS_VERSIONS
ClientFlag)MySQLConverterMySQLConverterBase)ErrorInterfaceErrorInternalErrorNotSupportedErrorProgrammingError)UNACCEPTABLE_TLS_CIPHERSUITESUNACCEPTABLE_TLS_VERSIONS)BinaryProtocolTypeDescriptionTypeEofPacketTypeHandShakeTypeMySQLScriptPartitionOkPacketTypeParamsSequenceType
ResultTypeRowTypeStatsPacketType
StrOrBytesWarningType)GenericWrapperimport_object   )MySQLAuthenticator)Charsetcharsets)MySQLProtocol)MySQLTcpSocketMySQLUnixSocketposixc                      e Zd ZU dZded<   ded<    ed      Zded	<   ded
<   ded<   ded<   ded<   ded<   ded<   dZded<   ddZy)r   zStores the server information retrieved on the handshake.

    Also parses and validates the server version, storing it as a tuple.
    intprotocolstrversionF)initzTuple[int, ...]version_tuple	thread_idcharsetstatus_flagsauth_pluginbytes	auth_datacapabilitiesboolquery_attrs_is_supportedc                   t        j                  d      }|j                  | j                        }|st	        d      t        d |j                         dd D              }|dk  rt	        d| j                   d      || _        y	)
zParse and validate server version.

        Raises:
            InterfaceError: If parsing fails or MySQL version is not supported.
        z$^(\d{1,2})\.(\d{1,2})\.(\d{1,3})(.*)zFailed parsing MySQL versionc              3  2   K   | ]  }t        |        y wN)rT   ).0vs     _/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/mysql/connector/aio/abstracts.py	<genexpr>z+ServerInfo.__post_init__.<locals>.<genexpr>   s     <1A<s   r      )   rK   zMySQL Version 'z' is not supportedN)recompilematchrW   r7   tuplegroupsrY   )self
version_rern   rW   s       rh   __post_init__zServerInfo.__post_init__   s|     ZZ GH
  . !?@@<q(;<<V ?4<<.@R!STT$    NreturnNone)	__name__
__module____qualname____doc____annotations__r
   rY   rb   rs    rt   rh   r   r      sT    
 ML%*%6M?6NL%*d*%rt   r   c            .         e Zd ZU dZddddddddddddddddi dddddddddded   ed   dded	   ed
   ed   ddddddded   dddd-	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZ	 	 	 d	 	 	 	 	 	 	 ddZddZddZ	ddZ
e	 d	 	 	 	 	 	 	 dd       Zeedd              Zedd       Zedd       Zedd       Zedd       Zedd       Zej*                  dd       Zedd       Zej*                  dd        Zedd!       Zej*                  dd"       Zdd#Zdd$Zedd%       Zej*                  dd&       Zedd'       Zedd(       Zedd)       Zedd*       Zedd+       Zedd,       Z e j*                  dd-       Z dd.Z!dd/Z"edd0       Z#e#j*                  dd1       Z#dd2Z$dd3Z%edd4       Z&e&j*                  dd5       Z&dd6Z'dd7Z(edd8       Z)e)j*                  dd9       Z)edd:       Z*e*j*                  dd;       Z*edd<       Z+e+j*                  dd=       Z+edd>       Z,edd?       Z-edd@       Z.eddA       Z/e/j*                  ddB       Z/eddC       Z0eddD       Z1eddE       Z2ddFZ3	 d	 	 	 	 	 ddGZ4ddHZ5ddIZ6ddJZ7 e8 e9jt                  dKL            ddM       Z; e8 e9jt                  dNL            ddO       Z<eddP       Z=eddQ       Z>eddR       Z?eddS       Z@e	 d	 	 	 	 	 	 	 ddT       ZA e8 e9jt                  dL            ddU       ZBeddV       ZCeCj*                  ddW       ZC e8 e9jt                  dL            ddX       ZDeddY       ZEeEj*                  ddZ       ZEedd[       ZFeFj*                  dd\       ZFdd]ZGdd^ZHdd_ZIdd`ZJddaZKddbZLddcZMdddZNedde       ZOdddfZPddgZQeddh       ZReRZSdieTdj<   e	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddk       ZUe	 	 	 d	 	 	 	 	 	 	 	 	 ddl       ZVe	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 ddm       ZWeddn       ZXeddo       ZYeddp       ZZeddq       Z[e	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddr       Z\	 	 	 	 	 	 ddsZ]e	 d	 	 	 	 	 	 	 ddt       Z^e	 	 	 	 	 	 ddu       Z_e	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddv       Z`e	 	 	 	 	 	 ddw       Zaeddx       Zbeddy       Zc	 	 	 	 	 	 	 	 	 	 ddzZdedd{       Zeeddd|       Zfedd}       Zgedd~       Zhedd       Ziedd       Zje	 	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Zky)r   z'Defines the MySQL connection interface.N z	127.0.0.1i  Fallow_local_infileallow_local_infile_in_pathconnect_timeoutread_timeoutwrite_timeoutTssl_disabled)-userpasswordhostportdatabase	password1	password2	password3r[   	collationr]   client_flagscompressconsume_results
autocommit	time_zone
conn_attrssql_modeinit_commandget_warningsraise_on_warningsbufferedrawkerberos_auth_modekrb_service_principalopenid_token_filewebauthn_callbackr   r   converter_classconverter_str_fallbackconnection_timeoutr   r   unix_socketuse_unicodessl_cassl_certssl_keyssl_verify_certssl_verify_identityr   tls_versionstls_ciphersuitesloopr   r   c       -        h   d | _         	 || _        || _        || _        || _        || _        || _        || _        || _        |#| _	        | | _
        |!| _        |"| _        || _        || _        || _        || _        || _        || _        || _        t)               | _        d | _        |	| _        	 |
| _        	 d| _        |*| _        |%| _        |&| _        |'| _        |(| _        |)| _        |+| _         |,| _!        || _"        d | _#        d | _$        |-xs tK        jL                         | _'        |xs tQ        jR                         | _*        d | _+        tY        jZ                         | _.        i | _/        d| _0        g | _1        te               | _3        |xs th        | _5        || _6        || _7        || _8        || _9        || _:        || _;        || _<        || _=        || _>        || _?        |$| _@        d| _A        d| _B        d| _C        d | _D        d | _E        || _F        d | _G        d | _H        	 d | _I        	 | j                          y )NF)K!_MySQLConnectionAbstract__charset_user	_password_host_port	_database
_password1
_password2
_password3_unix_socket_connection_timeout_read_timeout_write_timeout_connection_attrs	_compress_consume_results_autocommit
_time_zone	_sql_mode_init_commandrO   	_protocol_socket_charset_name_charset_collation_ssl_active_ssl_disabled_ssl_ca	_ssl_cert_ssl_key_ssl_verify_cert_ssl_verify_identity_tls_versions_tls_ciphersuites_auth_plugin_auth_plugin_class
_handshakeasyncioget_event_loop_loopr3   get_default_client_flags_server_infoweakrefWeakSet_cursors_query_attrs_query_attrs_supported_columns_descrL   _authenticatorr4   _converter_class_converter_str_fallback_kerberos_auth_mode_krb_service_principal_openid_token_file_allow_local_infile_allow_local_infile_in_path_get_warningsr   	_buffered_raw_use_unicode_have_next_result_unread_result_in_transaction_oci_config_file_oci_config_profile_webauthn_callback	converter_local_infile_filenames_query_validate_connection_options).rq   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   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s.                                                 rh   __init__z MySQLConnectionAbstract.__init__   sO   h -1	 
&

&(((!,(: ,8-:1;'&5!+)2(0,8(5IM,3C1:@!&#/&,(0'.0?4G!2>6F+61537,G**, 	
 #/"J*2H2H2J26)0):;=+0#462D2F6E6W-C$2D 5J#1B); :T(#/'8'	"-',$)%*/326  	 48=A$	( (,())+rt   c                b   K   | j                         s| j                          d {    | S 7 wre   )is_socket_connectedconnectrq   s    rh   
__aenter__z"MySQLConnectionAbstract.__aenter__/  s+     ''),,.   !s   $/-/c                @   K   | j                          d {    y 7 wre   closerq   exc_type	exc_value	tracebacks       rh   	__aexit__z!MySQLConnectionAbstract.__aexit__4        jjl   c                   | j                   r 	 | j                   j                         | _         | j                  rt        j
                  g| _        | j                  rt        j                  j                  | j                        }|r>t        j                  j                  |      rt        j                  j                  |      rt        j                  j                  |      rt        d      | j                  s| j                  rt        j                  g| _        nt        j                   g| _        | j                   dk(  rt#        d| j                    d      | j$                  rt        j&                  dk(  rd| _        | j(                  r4| j                   d	k(  rt#        d
      | j                   dk(  rt#        d      t+        | j,                  t.              st#        d      t1        | j2                  | j4                  | j6                  g      rt9        | j6                  | j4                  g      st        d      | j6                  du | j4                  du k7  rt        d      | j:                  | j=                          | j>                  | jA                          t+        | jB                  tD              st#        d      | jB                  jG                         D ]  \  }}|tH        v rt+        |tJ              st#        d| d| jB                   d      tM        |      dkD  rt#        d| d      |jO                  d      rt#        d      t+        |tJ              st#        d| d| d      tM        |      dkD  st#        d| d| d       | jP                  t        jR                  z  r| jU                          | jV                  rt+        | jV                  tJ              st#        d      | jV                  jY                         }|dk(  r&t        j&                  dk7  rt#        d       d!| _-        n|d"k(  rd#| _-        nt#        d$      | j\                  rt+        | j\                  tJ              st#        t_        j`                  d%&            | j\                  d'k(  rt#        t_        j`                  d(&            d)| j\                  vrt#        t_        j`                  d*&            | jb                  r| je                  d+| jb                  d,       | jf                  rt+        | jf                  tJ              st#        ti        j`                  d%&            | jf                  d'k(  rt#        ti        j`                  d-&            t        j                  j                  | jf                        st#        d.| jf                   d/      | jj                  4t+        | jj                  t.              r| jj                  d0k  rt#        d1      | jl                  5t+        | jl                  t.              r| jl                  d0k  rt#        d2      yy# t        $ r}t        d      |d}~ww xY w)3zValidate connection options.z'user' must be a stringNz.allow_local_infile_in_path must be a directoryauthentication_webauthn_client'z5' cannot be used as the default authentication pluginrR   Tmysql_clear_passwordzFClear password authentication is not supported over insecure  channels$authentication_openid_connect_clientzEOpenID Connect authentication is not supported over insecure channelsz'TCP/IP port number should be an integerz:ssl_key and ssl_cert need to be both specified, or neitherz4ssl_key and ssl_cert need to be both set, or neitherzconn_attrs must be of type dictz+Attribute name should be a string, found: 'z' in '    zAttribute name 'z"' exceeds 32 characters limit size_zNKey names in connection attributes cannot start with '_', found: '{attr_name}'zAttribute 'z
' value: 'z' must be a string typei   z$' exceeds 1024 characters limit sizez('kerberos_auth_mode' must be of type strsspintz6'kerberos_auth_mode=SSPI' is only available on WindowsMySQLSSPIKerberosAuthPlugingssapiMySQLKerberosAuthPluginz@Invalid 'kerberos_auth_mode' mode. Please use 'SSPI' or 'GSSAPI'zis not a string)errorr   zcan not be an empty string/zis incorrectly formattedwebauth_callbackrK   zcannot be an empty stringz
The path 'z1' provided via 'openid_token_file' does not existr   z.Option read_timeout must be a positive integerz/Option write_timeout must be a positive integer)7r   stripAttributeErrorr   r3   COMPRESSr   r   ospathabspathexistsisdirislinkr   LOCAL_FILESr   r7   r   namer   
isinstancer   rT   anyr   r   r   allr   _validate_tls_versionsr   _validate_tls_ciphersuitesr   dictitemsr+   rV   len
startswithr   CONNECT_ARGS_add_default_conn_attrsr   lowerr   r   r$   formatr   _validate_callabler   r&   r   r   )rq   errinfile_in_path	attr_name
attr_valuer   s         rh   r   z4MySQLConnectionAbstract._validate_connection_options<  s   ::I!ZZ--/
 >>!+!4!4 5D++WW__T-M-MNNGGNN>2n577>>.1$%UVV##t'G'G!+!7!7 8D","8"8!8 9D  @@ D%%& '   G!3!%D  $::$     $JJ$[  $**c* !JKKdnndmm<=t~~67$P  %4>>T+AB$J  !!-++-%%1//1$00$7 !BCC%)%;%;%A%A%C 	!IzM)i-$!{&)?)?(@C 
 9~"$&yk1ST  ##C($0 
 j#.$!)Jzl C' ' 
 :%$!)Jzl C9 9 9	B 
 7 77((*##d66<$%OPP!%!9!9!?!?!A!V+77d?(P  +H'#x/*C'$V  &&d993?$/66=NO  **b0$/66: 
 $555$/66=WX  ""##$68O8OQRS""d55s;$+229JK  &&",$+229TU  77>>$"9"9:$ !8!8 9 :% %  )d00#6$:L:Lq:P$%UVV*d11374;N;NQR;R$%VWW <S +u " I$%>?SHIs   Y 	Y+Y&&Y+c                   g }| j                   }t        |t              r|j                  d      r|j	                  d      st        d| d      |dd j                  d      }|st        d      |D ]4  }|j                         j                         }|s$|j                  |       6 n8t        |t        t        f      r|D cg c]  }|s|	 }}nt        d	| d      | j                  	t        d
d
 n| j                  d
d
 }|j                  d       |d   }g g g}i }g }	t        d
t        j                  |      dz    D ]2  }
|j!                  t"        |
          |	j%                  t&        |
          4 |D ]  }d|v r9||	v r5|t&        d   v r|d   j                  |       +|d   j                  |       @||v rd||   }||v r t        t)        j*                  d|            |t"        d   v r|d   j                  ||          |d   j                  ||          t        d| d       |d   s|d   st        d      |d   D ]*  }|t,        d   j/                         v st1        d| d       |d   D ]*  }|t,        d   j/                         v st1        d| d       dj3                  |d         dj3                  |d         g| _         y
c c}w )z&Validates the tls_ciphersuites option.[]z)tls_ciphersuites must be a list, found: 'r  rK   ,z6No valid cipher suite found in 'tls_ciphersuites' listzItls_ciphersuites should be a list with one or more ciphersuites. Found: 'NT)reverser   -TLSv1.3r   listvaluezThe value 'z1' in tls_ciphersuites is not a valid cipher suitez:No valid cipher suite found in the 'tls_ciphersuites' listzTLSv1.2zCipher z( when used with TLSv1.2 is unacceptable.z( when used with TLSv1.3 is unacceptable.:)r   r  rV   r%  endswithr  splitr  upperappendr8  setr   r2   sortindexupdater1   extendr0   r#   r)  r;   valuesr9   join)rq   r   tls_cstls_css_tls_csr   newer_tls_vertranslated_namesiani_cipher_suites_namesossl_cipher_suites_namestls_verr  translated_namecipher_as_ossls                 rh   r!  z2MySQLConnectionAbstract._validate_tls_ciphersuites  s{   ''fc"%%c*vs/C$?xqI  Qrl((-G$L  # 5 ,,...0$++G45
 s,5;F6vFF ))/3   $119LOt?Q?QRS?T 	 	$'$Q .0H#% .0  $$Kl&8&8&G!&KL 	GG$++,=g,FG$++,<W,EF	G % 	Dd{t'??+I66$Q'..t4$Q'..t411":4"@"&66(077!3? 
 ,Y77$Q'../G/MN$Q'../G/MN$!$ (# # '	.  "+;A+> L 
 /q1 	N!>y!I!P!P!RR'n--UV 	
 /q1 	N!>y!I!P!P!RR'n--UV 	 HH%a()HH%a()"
G  Gs   KKc                   g }| j                   }t        |t              r|j                  d      r|j	                  d      st        d| d      |dd j                  d      }|D ]M  }|j                         }|dk(  r||v r t        t        j                  d	|
            |j                  |       O |dgk(  rt        st        t        j                  |t                    t        |t              rJ|st        d      |D ]7  }||v r t        t        j                  d	|
            |j                  |       9 nNt        |t              r|D ]  }|j                  |        n%t        ddj!                  t               d| d      |st        d      g }g }g }|D ]F  }|t        v r|j                  |       |t"        v r|j                  |       6|j                  |       H |r7|dgk(  r)t        s#t%        t        j                  |t                    || _         y|r#t%        t'        j                  |t                    |r#t        t)        j                  t                    y)z"Validates the tls_versions option.r0  r1  z%tls_versions must be a list, found: 'r  rK   r2  r3  r   r   r7  r6  zJAt least one TLS protocol version must be specified in 'tls_versions' listz>tls_versions should be a list with one or more of versions in z, z
. found: 'zdAt least one TLS protocol version must be specified in 'tls_versions' list when this option is givenN)r   r  rV   r%  r;  r  r<  r  r#   r)  r>  r'   r(   r2   r8  r?  rE  r<   r9   r*   r)   )rq   r   tls_versiontls_versrM  use_tls_versionsunacceptable_tls_versionsinvalid_tls_versionss           rh   r   z.MySQLConnectionAbstract._validate_tls_versions<  s   ((k3'**3/K4H4H4M$;K=J  #1R(..s3H# 
1%mmo"$,.(077!/{ 
 ##K0
1 I;&/A$(//\J  T*$*  ' -l*(077!/w 
 ##G,- S)& -##G,- !ii-.jaI 
  C 
 $&!!# 	5G,& ''033)009$++G4	5 I;.7I'(//\J  "2D&#.55-| 
 " !2!9!9'<!PQQ "rt   c                   t        |t              r	 t        |      }t        |      st	        d|  d      t        t        |      j                        }||k7  rt	        d|  d| d|       y# t        $ r}t	        |       |d}~ww xY w)a  Validates if it's a Python callable.

         Args:
             option_name (str): Connection option name.
             callback (str or callable): The fully qualified path to the callable or
                                         a callable.
             num_args (int): Number of positional arguments allowed.

        Raises:
             ProgrammingError: If `callback` is not valid or wrong number of positional
                               arguments.

        .. versionadded:: 8.2.0
        NzExpected a callable for 'r  z' requires z4 positional argument, but the callback provided has )	r  rV   rJ   
ValueErrorr:   callabler$  r   
parameters)option_namecallbacknum_argsr+  
num_paramss        rh   r*  z*MySQLConnectionAbstract._validate_callable  s    $ h$:(2 !"%>{m1#MNN 8,778
!"K=H: 6))36  "  :&#0c9:s   A/ /	B
8BB
c                     y)zMySQL connection ID.Nr}   r   s    rh   connection_idz%MySQLConnectionAbstract.connection_id      rt   c                    | j                   S )z$User used while connecting to MySQL.)r   r   s    rh   r   zMySQLConnectionAbstract.user       zzrt   c                    | j                   S )z MySQL server IP address or name.)r   r   s    rh   server_hostz#MySQLConnectionAbstract.server_host  rb  rt   c                    | j                   S )zMySQL server TCP/IP port.)r   r   s    rh   server_portz#MySQLConnectionAbstract.server_port  rb  rt   c                    | j                   S )z MySQL Unix socket file location.)r   r   s    rh   r   z#MySQLConnectionAbstract.unix_socket          rt   c                    t        d      )Get the current database.zoThe use of async properties are not supported by Python. Use `await get_database()` to get the database insteadr:   r   s    rh   r   z MySQLConnectionAbstract.database  s     E
 	
rt   c                    t        d      )Set the current database.zsThe use of async properties are not supported by Python. Use `await set_database(name)` to set the database insteadrk  rq   r9  s     rh   r   z MySQLConnectionAbstract.database       I
 	
rt   c                    | j                   S )a  
        Gets the connection context's timeout in seconds for each attempt
        to read any data from the server.

        `read_timeout` is number of seconds upto which the connector should wait
        for the server to reply back before raising an ReadTimeoutError. We can set
        this option to None, which would signal the connector to wait indefinitely
        till the read operation is completed or stopped abruptly.
        r   r   s    rh   r   z$MySQLConnectionAbstract.read_timeout       !!!rt   c                V    | t        |t              r|dk  rt        d      || _        y)a  
        Sets or updates the connection context's timeout in seconds for each attempt
        to read any data from the server.

        `read_timeout` is number of seconds upto which the connector should wait
        for the server to reply back before raising an ReadTimeoutError. We can set
        this option to None, which would signal the connector to wait indefinitely
        till the read operation is completed or stopped abruptly.

        Args:
            timeout: Accepts a non-negative integer which is the timeout to be set
                     in seconds or None.
        Raises:
            InterfaceError: If a positive integer or None is not passed via the
                            timeout parameter.
        Examples:
            The following will set the read_timeout of the current session to
            5 seconds:
            ```
            >>> cnx = await mysql.connector.aio.connect(user='scott')
            >>> cnx.read_timeout = 5
            ```
        Nr   6Option read_timeout must be a positive integer or Noner  rT   r7   r   rq   timeouts     rh   r   z$MySQLConnectionAbstract.read_timeout  s4    2 gs+w{$L  %rt   c                    | j                   S )a  
        Gets the connection context's timeout in seconds for each attempt
        to send data to the server.

        `write_timeout` is number of seconds upto which the connector should spend to
        write to the server before raising an WriteTimeoutError. We can set this option
        to None, which would signal the connector to wait indefinitely till the write
        operation is completed or stopped abruptly.
        r   r   s    rh   r   z%MySQLConnectionAbstract.write_timeout       """rt   c                V    | t        |t              r|dk  rt        d      || _        y)a  
        Sets or updates the connection context's timeout in seconds for each attempt
        to send data to the server.

        `write_timeout` is number of seconds upto which the connector should spend to
        write to the server before raising an WriteTimeoutError. We can set this option
        to None, which would signal the connector to wait indefinitely till the write
        operation is completed or stopped abruptly.

        Args:
            timeout: Accepts a non-negative integer which is the timeout to be set in
                     seconds or None.
        Raises:
            InterfaceError: If a positive integer or None is not passed via the
                            timeout parameter.
        Examples:
            The following will set the write_timeout of the current
            session to 5 seconds:
            ```
            >>> cnx = await mysql.connector.connect(user='scott')
            >>> cnx.write_timeout = 5
            ```
        Nr   7Option write_timeout must be a positive integer or Noner  rT   r7   r   rv  s     rh   r   z%MySQLConnectionAbstract.write_timeout  s4    2 gs+w{$M  &rt   c                J   K   | j                  d       d{   }|d   S 7 	w)rj  zSELECT DATABASE()Nr   
info_query)rq   results     rh   get_databasez$MySQLConnectionAbstract.get_database3  s'     ':;;ay <   #!
#c                H   K   | j                  d|        d{    y7 w)rm  zUSE N)	cmd_queryrn  s     rh   set_databasez$MySQLConnectionAbstract.set_database8  s     nntE7^,,,s   " "c                    | j                   S )z"Returns whether to consume results)r   r   s    rh   can_consume_resultsz+MySQLConnectionAbstract.can_consume_results<       $$$rt   c                6    t        |t              sJ || _        y)zSet if can consume results.N)r  ra   r   rn  s     rh   r  z+MySQLConnectionAbstract.can_consume_resultsA  s     %&& %rt   c                    | j                   S )z(MySQL session has started a transaction.)r   r   s    rh   in_transactionz&MySQLConnectionAbstract.in_transactionG  s     ###rt   c                    | j                   S )zReturn the event loop.)r   r   s    rh   r   zMySQLConnectionAbstract.loopL  rb  rt   c                J    | j                   xs | j                  duxr t        S )z&Return True if is a secure connection.N)r   r   IS_POSIXr   s    rh   	is_securez!MySQLConnectionAbstract.is_secureQ  s%     OD$5$5T$A$NhOrt   c                H    t        | j                  j                               S )zReturns query attributes list.)r8  r   r#  r   s    rh   query_attrsz#MySQLConnectionAbstract.query_attrsV  s     D%%++-..rt   c                    | j                   S )zReturn if have next result.)r   r   s    rh   have_next_resultz(MySQLConnectionAbstract.have_next_result[  s     %%%rt   c                    t        d      )$Get whether autocommit is on or off.zsThe use of async properties are not supported by Python. Use `await get_autocommit()` to get the autocommit insteadrk  r   s    rh   r   z"MySQLConnectionAbstract.autocommit`  ro  rt   c                    t        d      )Toggle autocommit.zxThe use of async properties are not supported by Python. Use `await set_autocommit(value)` to set the autocommit insteadrk  rn  s     rh   r   z"MySQLConnectionAbstract.autocommith       N
 	
rt   c                P   K   | j                  d       d{   }|d   dk(  S 7 w)r  zSELECT @@session.autocommitNr   rK   r  rn  s     rh   get_autocommitz&MySQLConnectionAbstract.get_autocommitp  s,     oo&CDDQx1} Es   &$&c                b   K   |rdnd}| j                  d|        d{    || _        y7 w)r  ONOFFzSET @@session.autocommit = N)r  r   )rq   r9  switchs      rh   set_autocommitz&MySQLConnectionAbstract.set_autocommitu  s7     Enn:6(CDDD  	Es   /-/c                    t        d      )Gets the current time zone.zqThe use of async properties are not supported by Python. Use `await get_time_zone()` to get the time zone insteadrk  r   s    rh   r   z!MySQLConnectionAbstract.time_zone{  s     G
 	
rt   c                    t        d      )Sets the time zone.zxThe use of async properties are not supported by Python. Use `await get_autocommit(value)` to get the autocommit insteadrk  rn  s     rh   r   z!MySQLConnectionAbstract.time_zone  r  rt   c                J   K   | j                  d       d{   }|d   S 7 	w)r  zSELECT @@session.time_zoneNr   r  rn  s     rh   get_time_zonez%MySQLConnectionAbstract.get_time_zone  s'     oo&BCCQx Dr  c                X   K   | j                  d| d       d{    || _        y7 w)r  zSET @@session.time_zone = 'r  N)r  r   rn  s     rh   set_time_zonez%MySQLConnectionAbstract.set_time_zone  s/     nn:5'CDDD 	Es   *(*c                    K   t        d      w)Gets the SQL mode.zoThe use of async properties are not supported by Python. Use `await get_sql_mode()` to get the SQL mode insteadrk  r   s    rh   r   z MySQLConnectionAbstract.sql_mode  s      E
 	
   c                    K   t        d      w)  Sets the SQL mode.

        This method sets the SQL Mode for the current connection. The value
        argument can be either a string with comma separate mode names, or
        a sequence of mode names.

        It is good practice to use the constants class `SQLMode`:
        ```
        >>> from mysql.connector.constants import SQLMode
        >>> cnx.sql_mode = [SQLMode.NO_ZERO_DATE, SQLMode.REAL_AS_FLOAT]
        ```
        ztThe use of async properties are not supported by Python. Use `await set_sql_mode(value)` to set the SQL mode insteadrk  rn  s     rh   r   z MySQLConnectionAbstract.sql_mode  s      J
 	
r  c                   K   | j                   !| j                  d       d{   d   | _         | j                   S 7 w)r  NzSELECT @@session.sql_moder   )r   r  r   s    rh   get_sql_modez$MySQLConnectionAbstract.get_sql_mode  s:     >>!$(OO4O$PPRSTDN~~ Qs   !><>c                   K   t        |t        t        f      rdj                  |      }| j	                  d| d       d{    || _        y7 w)r  r3  zSET @@session.sql_mode = 'r  N)r  r8  ro   rE  r  r   rn  s     rh   set_sql_modez$MySQLConnectionAbstract.set_sql_mode  sL      edE]+HHUOEnn9%BCCC 	Ds   A AAAc                    | j                   S )zGet whether this connection retrieves warnings automatically.

        This method returns whether this connection retrieves warnings automatically.
        )r   r   s    rh   r   z$MySQLConnectionAbstract.get_warnings  s     !!!rt   c                H    t        |t              st        d      || _        y)a  Set whether warnings should be automatically retrieved.

        The toggle-argument must be a boolean. When True, cursors for this connection
        will retrieve information about warnings (if any).

        Raises:
            ValueError: When the value is not a bool type.
        Expected a boolean typeN)r  ra   rW  r   rn  s     rh   r   z$MySQLConnectionAbstract.get_warnings  s"     %&677"rt   c                    | j                   S )zGet whether this connection raises an error on warnings.

        This method returns whether this connection will raise errors when MySQL
        reports warnings.
        )_raise_on_warningsr   s    rh   r   z)MySQLConnectionAbstract.raise_on_warnings  s     &&&rt   c                \    t        |t              st        d      || _        |r|| _        yy)a  Set whether warnings raise an error.

        The toggle-argument must be a boolean. When True, cursors for this connection
        will raise an error when MySQL reports warnings.

        Raising on warnings implies retrieving warnings automatically.
        In other words: warnings will be set to True. If set to False, warnings will
        be also set to False.

        Raises:
            ValueError: When the value is not a bool type.
        r  N)r  ra   rW  r  r   rn  s     rh   r   z)MySQLConnectionAbstract.raise_on_warnings  s2     %&677"'!&D rt   c                    | j                   S )zGet whether there is an unread result.

        This method is used by cursors to check whether another cursor still needs to
        retrieve its result set.
        )r   r   s    rh   unread_resultz%MySQLConnectionAbstract.unread_result       """rt   c                H    t        |t              st        d      || _        y)zSet whether there is an unread result.

        This method is used by cursors to let other cursors know there is still a
        result set that needs to be retrieved.

        Raises:
            ValueError: When the value is not a bool type.
        r  N)r  ra   rW  r   rn  s     rh   r  z%MySQLConnectionAbstract.unread_result  s"     %&677#rt   c                .    | j                   j                  S )a   Returns the collation for current connection.

        This property returns the collation name of the current connection.
        The server is queried when the connection is active. If not connected,
        the configured collation name is returned.

        Returns a string.
        )_charsetr   r   s    rh   r   z!MySQLConnectionAbstract.collation  s     }}&&&rt   c                .    | j                   j                  S )a  Return the character set for current connection.

        This property returns the character set name of the current connection.
        The server is queried when the connection is active.
        If not connected, the configured character set name is returned.
        r  r  r   s    rh   r[   zMySQLConnectionAbstract.charset  s     }}!!!rt   c                .    | j                   j                  S )zThe charset ID utilized during the connection phase.

        If the charset ID hasn't been set, the default charset ID is returned.
        )r  
charset_idr   s    rh   r  z"MySQLConnectionAbstract.charset_id)  s     }}'''rt   c                    | j                   b| j                  t        j                  t              S t        j                  | j                  j
                  dk  rt        nt              | _         | j                   S )BThe charset object encapsulates charset and collation information.)   r   )r   r   rN   	get_by_idr.   rY   r/   r   s    rh   r  z MySQLConnectionAbstract._charset1  sj     >>!  (
  ))*EFF%// ((66? 04	DN ~~rt   c                    || _         y)r  N)r   rn  s     rh   r  z MySQLConnectionAbstract._charsetE  s     rt   c                x    | j                   | j                   j                  dv ry| j                   j                  S )a^  Return the Python character set for current connection.

        This property returns the character set name of the current connection.
        Note that, unlike property charset, this checks if the previously set
        character set is supported by Python and if not, it returns the equivalent
        character set that Python supports.
        )utf8mb4utf8mb3binaryutf8r  r   s    rh   python_charsetz&MySQLConnectionAbstract.python_charsetJ  s9     == DMM$6$6 ;
 %

 }}!!!rt   c                     y)z&Add the default connection attributes.Nr}   r   s    rh   r'  z/MySQLConnectionAbstract._add_default_conn_attrs[  r`  rt   c                   K   yw)zExecute a query.

        This method simply calls cmd_query() after checking for unread result. If there
        are still unread result, an InterfaceError is raised. Otherwise whatever
        cmd_query() returns is returned.
        Nr}   )rq   querys     rh   _execute_queryz&MySQLConnectionAbstract._execute_query_          c                  K   | j                  | j                  j                         d{    | j                  | j                         d{    | j
                  r#| j                  | j
                         d{    | j                  r#| j                  | j                         d{    | j                  r$| j                  | j                         d{    yy7 7 7 h7 ;7 w)zExecutes commands after connection has been established.

        This method executes commands after the connection has been established.
        Some setting like autocommit, character set, and SQL mode are set using this
        method.
        )r[   N)set_charset_collationr  r  r  r   r   r  r   r  r   r  r   s    rh   _post_connectionz(MySQLConnectionAbstract._post_connectionh  s      ((1I1I(JJJ!!$"2"2333??$$T__555>>##DNN333%%d&8&8999  	K3539sW   *C-C#"C-C%.C->C'?.C--C)..C-C+C-%C-'C-)C-+C-c                  K   d}t        |t        t        f      s|t        |j	                  d            t        |t              s|t        d      |rO|rMt        |t              rt        j                  |      j                  n|}t        j                  ||      | _	        n|rpt        |t              rt        j                  |      | _	        nt        |t              rt        j                  |      | _	        nZt        |j	                  d            |rt        j                  |      | _	        n#t        d   }t        j                  |      | _	        | j                  d| j                  j                   d| j                  j                   d       d{    | j                  r0| j                  j!                  | j                  j                         yy7 Aw)a  Set the character set and collation for the current connection.

        This method sets the character set and collation to be used for the current
        connection. The charset argument can be either the name of a character set as
        a string, or the numerical equivalent as defined in constants.CharacterSet.

        When the collation is not given, the default will be looked up and used.

        Args:
            charset: Can be either the name of a character set, or the numerical
                     equivalent as defined in `constants.CharacterSet`.
            collation: When collation is `None`, the default collation for the
                       character set is used.

        Examples:
            The following will set the collation for the latin1 character set to
            `latin1_general_ci`:
            ```
            >>> cnx = mysql.connector.connect(user='scott')
            >>> cnx.set_charset_collation('latin1', 'latin1_general_ci')
            ```
        z+{} should be either integer, string or NoneNr[   z)collation should be either string or NonezSET NAMES 'z' COLLATE 'r  )r  rT   rV   rW  r)  rN   r  r  get_by_name_and_collationr  get_by_nameget_by_collationr,   r  r   r   set_charset)rq   r[   r   err_msgcharset_strs        rh   r  z-MySQLConnectionAbstract.set_charset_collationx  s    2 @'C:.73FW^^I677)S)i.CHIIy gs+ ""7+00 
 %>>{IVDM'3' ( 2 27 ;GS) ( 4 4W = 	!:;;$55i@DM+I6G$009DMnn$--,,-[9P9P8QQRS
 	
 	
 >>NN&&t}}'9'9: 		
s   FGGAGc                &    | j                   |z  dkD  S )z|Checks if a client flag is set.

        Returns:
            `True` if the client flag was set, `False` otherwise.
        r   r   )rq   flags     rh   isset_client_flagz)MySQLConnectionAbstract.isset_client_flag  s     ""T)Q..rt   c                    || _         y)zySet the path that user can upload files.

        Args:
            path (str): Path that user can upload files.
        N)r   )rq   r  s     rh   set_allow_local_infile_in_pathz6MySQLConnectionAbstract.set_allow_local_infile_in_path  s     ,0(rt   c                    | S )zReturn self for weakref.proxy.

        This method is used when the original object is needed when using
        weakref.proxy.
        r}   r   s    rh   get_selfz MySQLConnectionAbstract.get_self  s	     rt   server_versionproperty_namec                    | j                   S )Gets the MySQL version.

        Returns:
            The MySQL server version as a tuple. If not previously connected, it will
            return `None`.
        )r  r   s    rh   get_server_versionz*MySQLConnectionAbstract.get_server_version  s     """rt   server_infoc                    | j                   S )Gets the original MySQL version information.

        Returns:
            The original MySQL server as text. If not previously connected, it will
            return `None`.
        )r  r   s    rh   get_server_infoz'MySQLConnectionAbstract.get_server_info  s     rt   c                H    | j                   | j                   j                  S y)r  N)r   rY   r   s    rh   r  z&MySQLConnectionAbstract.server_version  s%     ($$222rt   c                L    	 | j                   d   S # t        t        f$ r Y yw xY w)r  server_version_originalN)r   	TypeErrorKeyErrorr   s    rh   r  z#MySQLConnectionAbstract.server_info  s.    	??#<==8$ 		s    ##c                     y)zReports whether the socket is connected.

        Instead of ping the server like ``is_connected()``, it only checks if the
        socket connection flag is set.
        Nr}   r   s    rh   r   z+MySQLConnectionAbstract.is_socket_connected  r`  rt   c                   K   yw)a  Reports whether the connection to MySQL Server is available.

        This method checks whether the connection to MySQL is available.
        It is similar to ``ping()``, but unlike the ``ping()`` method, either `True`
        or `False` is returned and no exception is raised.
        Nr}   r   s    rh   is_connectedz$MySQLConnectionAbstract.is_connected   r  r  c                   K   yw)a  Check availability of the MySQL server.

        When reconnect is set to `True`, one or more attempts are made to try to
        reconnect to the MySQL server using the ``reconnect()`` method.

        ``delay`` is the number of seconds to wait between each retry.

        When the connection is not available, an InterfaceError is raised. Use the
        ``is_connected()`` method if you just want to check the connection without
        raising an error.

        Raises:
            InterfaceError: On errors.
        Nr}   )rq   	reconnectattemptsdelays       rh   pingzMySQLConnectionAbstract.ping	  r  r  c                (    || _         | j                   S )a  Set the client flags.

        The flags-argument can be either an int or a list (or tuple) of ClientFlag
        values. If it is an integer, it will set client_flags to flags as is.
        If flags is a list or tuple, each flag will be set or unset when it's negative.

        client_flags = [ClientFlag.FOUND_ROWS,-ClientFlag.LONG_FLAG]

        Raises:
            ProgrammingError: When the flags argument is not a set or an integer bigger
                              than 0.
        )r   )rq   flagss     rh   set_client_flagsz(MySQLConnectionAbstract.set_client_flags  s     "   rt   c                    | j                   S )z-Gets the client flags of the current session.r  r   s    rh   r   z$MySQLConnectionAbstract.client_flags-  s     !!!rt   c                   t        |t              r|dkD  r|| _        yt        |t        t        f      rB|D ]<  }|dk  r | xj                  t        |       z  c_        (| xj                  |z  c_        > yt        d      )a  Sets the client flags.

        The flags-argument can be either an int or a list (or tuple) of ClientFlag
        values. If it is an integer, it will set client_flags to flags as is.
        If flags is a list or tuple, each flag will be set or unset when it's negative.

        client_flags = [ClientFlag.FOUND_ROWS,-ClientFlag.LONG_FLAG]

        Raises:
            ProgrammingError: When the flags argument is not a set or an integer bigger
                              than 0.
        r   z.client_flags setter expect integer (>0) or setN)r  rT   r   ro   r8  absr:   )rq   r  r  s      rh   r   z$MySQLConnectionAbstract.client_flags2  sv     eS!eai!&Dt}- /!8&&3t9*4&&&$.&	/ ##STTrt   c                    || _         y)zSet the converter class to be used.

        This should be a class overloading methods and members of
        conversion.MySQLConverter.

        Raises:
            TypeError: When the class is not a subclass of `conversion.MySQLConverter`.
        N)r   rq   	convclasss     rh   set_converter_classz+MySQLConnectionAbstract.set_converter_classK  s      )rt   c                    | j                   S )z5Gets the converter class set for the current session.)r   r   s    rh   r   z'MySQLConnectionAbstract.converter_classW  r  rt   c                    |r_t        |t              rO|| _         || j                  j                  | j
                        | _        | j                  | j                  _        yt        d      )zSets the converter class to be used.

        This should be a class overloading methods and members of
        conversion.MySQLConverter.

        Raises:
            TypeError: When the class is not a subclass of `conversion.MySQLConverter`.
        zAConverter class should be a subclass of conversion.MySQLConverterN)

issubclassr5   r   r  r  r   r   r   str_fallbackr  r  s     rh   r   z'MySQLConnectionAbstract.converter_class\  sY     I/AB$-D!&t}}'9'94;K;KLDN*.*F*FDNN'S rt   c                    | j                   S )z7Gets whether we return string fields as unicode or not.)r   r   s    rh   r   z#MySQLConnectionAbstract.use_unicodeo  rh  rt   c                b    || _         | j                  r| j                  j                  |       yy)zSets whether we return string fields as unicode or not.

        Args:
            value: A boolean - default is `True`.
        N)r   r   set_unicodern  s     rh   r   z#MySQLConnectionAbstract.use_unicodet  s*     ">>NN&&u- rt   c                J    |\  }}|| j                   vr|| j                   |<   yy)a  Add element to the query attributes list on the connector's side.

        If an element in the query attributes list already matches
        the attribute name provided, the new element will NOT be added.

        Args:
            value: key-value as a 2-tuple.
        Nr   )rq   r9  r-  r.  s       rh   query_attrs_appendz*MySQLConnectionAbstract.query_attrs_append  s1     !&	:D---+5Di( .rt   c                :    | j                   j                  |d      S )zRemove element by name from the query attributes list.

        If no match, `None` is returned, else the corresponding value is returned.

        Args:
            name: key name.
        N)r   poprq   r  s     rh   query_attrs_removez*MySQLConnectionAbstract.query_attrs_remove  s       $$T400rt   c                    i | _         y)z5Clears query attributes list on the connector's side.Nr  r   s    rh   query_attrs_clearz)MySQLConnectionAbstract.query_attrs_clear  s
    rt   c                   K   | j                   r| j                          d{    y| j                  rt        d      y7 w)zHandle unread result.

        Consume pending results if is configured for it.

        Raises:
            InternalError: When there are pending results and they were not consumed.
        NzUnread result found)r   r   r  r8   r   s    rh   handle_unread_resultz,MySQLConnectionAbstract.handle_unread_result  sB        &&((( 566   )s    AA Ac                Z   K   | j                   r| j                          d{    yy7 w)zConsume pending results.N)r  get_rowsr   s    rh   r   z'MySQLConnectionAbstract.consume_results  s&     --/!! !s    +)+c                .  K   | j                  d       d{   4 d{   }|j                  t        t        |             d{    |j	                          d{   cddd      d{    S 7 ]7 V7 17 7 # 1 d{  7  sw Y   yxY ww)z&Send a query which only returns 1 row.T)r   N)cursorexecuter    rV   fetchone)rq   r  r  s      rh   r  z"MySQLConnectionAbstract.info_query  s     d33 	+ 	+v..c5!1222**	+ 	+ 	+3 	+2*	+ 	+ 	+ 	+sx   BA6BA8B#B A:	B  A<!B $B0A>1B8B:B <B >B BB	BBc                :    | j                   j                  |       y)zAdd cursor to the weakref set.N)r   addrq   r  s     rh   
add_cursorz"MySQLConnectionAbstract.add_cursor  s    &!rt   c                :    | j                   j                  |       y)z#Remove cursor from the weakref set.N)r   remover   s     rh   remove_cursorz%MySQLConnectionAbstract.remove_cursor  s    V$rt   c                   K   yw)zConnect to the MySQL server.Nr}   r   s    rh   r   zMySQLConnectionAbstract.connect  r  r  c                  K   d}||k7  ry|dz   }	 | j                          d{    | j                          d{    | j                          d{   ry	 |dkD  rt        j                  |       d{    ||k7  rxyy7 `7 J7 4# t        t        f$ r#}||k(  rd| d| }t        |      |Y d}~]d}~ww xY w7 Gw)a  Attempts to reconnect to the MySQL server.

        The argument `attempts` should be the number of times a reconnect is tried.
        The `delay` argument is the number of seconds to wait between each retry.

        You may want to set the number of attempts higher and use delay when you expect
        the MySQL server to be down for maintenance or when you expect the network to
        be temporary unavailable.

        Args:
            attempts: Number of attempts to make when reconnecting.
            delay: Use it (defined in seconds) if you want to wait between each retry.

        Raises:
            InterfaceError: When reconnection fails.
        r   rK   Nz!Can not reconnect to MySQL after z attempt(s): )
disconnectr   r  r6   IOErrorr7   r   sleep)rq   r  r  counterr+  msgs         rh   r  z!MySQLConnectionAbstract.reconnect  s     " !kG7oo'''lln$$**,,, - qymmE*** ! ($,7# 7h&;H: F''*e-  )-36 '7 +sr   CB
 BB
 BB
 BB
 C7B?8	CCB
 B
 B
 
B<B72C7B<<Cc                   K   t         w)ak  Shuts down connection to MySQL Server.

        This method closes the socket. It raises no exceptions.

        Unlike `disconnect()`, `shutdown()` closes the client connection without
        attempting to send a `QUIT` command to the server first. Thus, it will not
        block if the connection is disrupted for some reason such as network failure.
        )NotImplementedErrorr   s    rh   shutdownz MySQLConnectionAbstract.shutdown  s      "!s   	c                   K   yw)a  Close the connection.

        It closes any opened cursor associated to this connection, and closes the
        underling socket connection.

        `MySQLConnection.close()` is a synonymous for `MySQLConnection.disconnect()`
        method name and more commonly used.

        This method tries to send a `QUIT` command and close the socket. It raises
        no exceptions.
        Nr}   r   s    rh   r   zMySQLConnectionAbstract.close  r  r  z@ClassVar[Callable[['MySQLConnectionAbstract'], Awaitable[None]]]r'  c                   K   yw)a  Instantiate and return a cursor.

        By default, MySQLCursor is returned. Depending on the options while
        connecting, a buffered and/or raw cursor is instantiated instead.
        Also depending upon the cursor options, rows can be returned as a dictionary
        or a tuple.

        It is possible to also give a custom cursor through the cursor_class
        parameter, but it needs to be a subclass of
        mysql.connector.aio.abstracts.MySQLCursorAbstract.

        Raises:
            ProgrammingError: When cursor_class is not a subclass of
                              MySQLCursor.
            ValueError: When cursor is not available.
        Nr}   )rq   r   r   preparedcursor_class
dictionaryr   r   s           rh   r  zMySQLConnectionAbstract.cursor  r  r  c                   K   yw)a3  Get the next rows returned by the MySQL server.

        This method gets one row from the result set after sending, for example, the
        query command. The result is a tuple consisting of the row and the EOF packet.
        If no row was available in the result set, the row data will be None.
        Nr}   )rq   r  columnsr   kwargss        rh   get_rowzMySQLConnectionAbstract.get_row  r  r  c                   K   yw)zGet all rows returned by the MySQL server.

        This method gets all rows returned by the MySQL server after sending, for
        example, the query command. The result is a tuple consisting of a list of rows
        and the EOF packet.
        Nr}   )rq   countr  r5  r   	prep_stmtr6  s          rh   r  z MySQLConnectionAbstract.get_rows'  r  r  c                   K   yw)zCommit current transaction.Nr}   r   s    rh   commitzMySQLConnectionAbstract.commit8  r  r  c                   K   yw)zRollback current transaction.Nr}   r   s    rh   rollbackz MySQLConnectionAbstract.rollback<  r  r  c                   K   yw)zResets the session state without re-authenticating.

        Reset command only works on MySQL server 5.7.3 or later.
        The result is True for a successful reset otherwise False.
        Nr}   r   s    rh   cmd_reset_connectionz,MySQLConnectionAbstract.cmd_reset_connection@  r  r  c                   K   yw)zChange the current database.

        This method changes the current (default) database by sending the INIT_DB
        command. The result is a dictionary containing the OK packet infawaitormation.
        Nr}   )rq   r   s     rh   cmd_init_dbz#MySQLConnectionAbstract.cmd_init_dbH  r  r  c                   K   yw)a  Send a query to the MySQL server.

        This method send the query to the MySQL server and returns the result.

        If there was a text result, a tuple will be returned consisting of the number
        of columns and a list containing information about these columns.

        When the query doesn't return a text result, the OK or EOF packet information
        as dictionary will be returned. In case the result was an error, exception
        Error will be raised.
        Nr}   )rq   r  r   r   raw_as_stringr6  s         rh   r  z!MySQLConnectionAbstract.cmd_queryP  r  r  c                   K   yw)ac  Send one or more statements to the MySQL server.

        Similar to the cmd_query method, but instead returns a generator
        object to iterate through results. It sends the statements to the
        MySQL server and through the iterator you can get the results.

        statement = 'SELECT 1; INSERT INTO t1 VALUES (); SELECT 2'
        for result in await cnx.cmd_query(statement, iterate=True):
            if 'columns' in result:
                columns = result['columns']
                rows = await cnx.get_rows()
            else:
                # do something useful with INSERT result
        Nr}   )rq   
statementsr6  s      rh   cmd_query_iterz&MySQLConnectionAbstract.cmd_query_itere  r  r  c                   K   yw)zFetch a MySQL statement Result Set.

        This method will send the FETCH command to MySQL together with the given
        statement id and the number of rows to fetch.
        Nr}   )rq   statement_idrowsr6  s       rh   cmd_stmt_fetchz&MySQLConnectionAbstract.cmd_stmt_fetchy  r  r  c                   K   yw)zPrepare a MySQL statement.

        This method will send the PREPARE command to MySQL together with the given
        statement.
        Nr}   )rq   	statementr6  s      rh   cmd_stmt_preparez(MySQLConnectionAbstract.cmd_stmt_prepare  r  r  c                   K   yw)z#Execute a prepared MySQL statement.Nr}   )rq   rI  datarY  r  r6  s         rh   cmd_stmt_executez(MySQLConnectionAbstract.cmd_stmt_execute  r  r  c                   K   yw)z}Reset data for prepared statement sent as long data.

        The result is a dictionary with OK packet information.
        Nr}   rq   rI  r6  s      rh   cmd_stmt_resetz&MySQLConnectionAbstract.cmd_stmt_reset  r  r  c                   K   yw)zDeallocate a prepared MySQL statement.

        This method deallocates the prepared statement using the statement_id.
        Note that the MySQL server does not return anything.
        Nr}   rS  s      rh   cmd_stmt_closez&MySQLConnectionAbstract.cmd_stmt_close  r  r  c                   K   yw)a  Send the Refresh command to the MySQL server.

        This method sends the Refresh command to the MySQL server. The options
        argument should be a bitwise value using constants.RefreshOption.

        Typical usage example:
            ```
           RefreshOption = mysql.connector.RefreshOption
           refresh = RefreshOption.LOG | RefreshOption.INFO
           await cnx.cmd_refresh(refresh)
           ```

        Args:
            options: Bitmask value constructed using constants from
                     the `constants.RefreshOption` class.

        Returns:
            A dictionary representing the OK packet got as response when executing
            the command.

        Raises:
            ValueError: If an invalid command `refresh options` is provided.
            DeprecationWarning: If one of the options is deprecated for the server you
                                are connecting to.
        Nr}   )rq   optionss     rh   cmd_refreshz#MySQLConnectionAbstract.cmd_refresh  r  r  c                   K   yw)a  Send data for a column.

        This methods send data for a column (for example BLOB) for statement identified
        by statement_id. The param_id indicate which parameter the data belongs too.
        The data argument should be a file-like object.

        Since MySQL does not send anything back, no error is raised. When the MySQL
        server is not reachable, an OperationalError is raised.

        cmd_stmt_send_long_data should be called before cmd_stmt_execute.

        The total bytes send is returned.
        Nr}   )rq   rI  param_idrP  r6  s        rh   cmd_stmt_send_long_dataz/MySQLConnectionAbstract.cmd_stmt_send_long_data  r  r  c                   K   yw)zClose the current connection with the server.

        Send the QUIT command to the MySQL server, closing the current connection.
        Nr}   r   s    rh   cmd_quitz MySQLConnectionAbstract.cmd_quit  r  r  c                   K   yw)zShut down the MySQL Server.

        This method sends the SHUTDOWN command to the MySQL server.
        The `shutdown_type` is not used, and it's kept for backward compatibility.
        Nr}   )rq   shutdown_types     rh   cmd_shutdownz$MySQLConnectionAbstract.cmd_shutdown  r  r  c                   K   yw)zSend the statistics command to the MySQL Server.

        This method sends the STATISTICS command to the MySQL server. The result is a
        dictionary with various statistical information.
        Nr}   r   s    rh   cmd_statisticsz&MySQLConnectionAbstract.cmd_statistics  r  r  c                   K   yw)zKill a MySQL process.

        This method send the PROCESS_KILL command to the server along with the
        process ID. The result is a dictionary with the OK packet information.
        Nr}   )rq   	mysql_pids     rh   cmd_process_killz(MySQLConnectionAbstract.cmd_process_kill  r  r  c                   K   yw)a-  Send the DEBUG command.

        This method sends the DEBUG command to the MySQL server, which requires the
        MySQL user to have SUPER privilege. The output will go to the MySQL server
        error log and the result of this method is a dictionary with EOF packet
        information.
        Nr}   r   s    rh   	cmd_debugz!MySQLConnectionAbstract.cmd_debug  r  r  c                   K   yw)zSend the PING command.

        This method sends the PING command to the MySQL server. It is used to check
        if the the connection is still valid. The result of this method is dictionary
        with OK packet information.
        Nr}   r   s    rh   cmd_pingz MySQLConnectionAbstract.cmd_ping  r  r  c                   K   yw)a  Changes the current logged in user.

        It also causes the specified database to become the default (current)
        database. It is also possible to change the character set using the
        charset argument. The character set passed during initial connection
        is reused if no value of charset is passed via this method.

        Args:
            username: New account's username.
            password: New account's password.
            database: Database to become the default (current) database.
            charset: Client charset (see [1]), only the lower 8-bits.
            password1: New account's password factor 1 - it's used instead
                       of `password` if set (higher precedence).
            password2: New account's password factor 2.
            password3: New account's password factor 3.
            oci_config_file: OCI configuration file location (path-like string).
            oci_config_profile: OCI configuration profile location (path-like string).
            openid_token_file: OpenID Connect token file location (path-like string).

        Returns:
            ok_packet: Dictionary containing the OK packet information.

        Examples:
            ```
            >>> cnx.cmd_change_user(username='', password='', database='', charset=33)
            ```

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/                page_protocol_basic_character_set.html#a_protocol_character_set
        Nr}   )rq   usernamer   r   r[   r   r   r   oci_config_fileoci_config_profiler   s              rh   cmd_change_userz'MySQLConnectionAbstract.cmd_change_user  r  r  )Zr   Optional[str]r   rV   r   rV   r   rT   r   rp  r   rV   r   rV   r   rV   r[   rV   r   rV   r]   rp  r   Optional[int]r   ra   r   ra   r   ra   r   rp  r   zDict[str, str]r   rp  r   rp  r   ra   r   ra   r   ra   r   ra   r   rp  r   rp  r   rp  r   z+Optional[Union[str, Callable[[str], None]]]r   ra   r   rp  r   zOptional[MySQLConverter]r   ra   r   rT   r   rq  r   rq  r   rp  r   Optional[bool]r   rp  r   rp  r   rp  r   rr  r   rr  r   rr  r   Optional[List[str]]r   rs  r   z#Optional[asyncio.AbstractEventLoop])rv   r   NNNr   zOptional[Type[BaseException]]r   zOptional[BaseException]r   zOptional[TracebackType]rv   rw   ru   )r   )rZ  rV   r[  zUnion[str, Callable]r\  rT   rv   rw   rv   rq  )rv   rV   rv   rT   rv   rp  )r9  rV   rv   rw   rw  rq  rv   rw   rv   ra   )r9  ra   rv   rw   )rv   zasyncio.AbstractEventLoop)rv   z$List[Tuple[str, BinaryProtocolType]])r9  zUnion[str, Sequence[int]]rv   rw   )rv   rM   )r9  rM   rv   rw   )r  rV   rv   rD   NN)r[   zOptional[Union[int, str]]r   rp  rv   rw   )r  rT   rv   ra   )r  rV   rv   rw   )rv   zOptional[Tuple[int, ...]])FrK   r   )r  ra   r  rT   r  rT   rv   ra   )r  Union[int, Sequence[int]]rv   rT   )r  r|  rv   rw   )r  zOptional[Type[MySQLConverter]]rv   rw   )rv   zType[MySQLConverter])r9  zTuple[str, BinaryProtocolType]rv   rw   r  rV   rv   r=   )r  rG   rv   Optional[RowType])r  r   rv   rw   )rK   r   )r  rT   r  rT   rv   rw   )rv   r   )NNNNNNN)r   rr  r   rr  r1  rr  r2  z#Optional[Type[MySQLCursorAbstract]]r3  rr  r   rq  r   rq  rv   r   )FNN)
r  ra   r5  Optional[List[DescriptionType]]r   rr  r6  r   rv   z1Tuple[Optional[RowType], Optional[EofPacketType]])NFNNN)r9  rq  r  ra   r5  r  r   rr  r:  r   r6  r   rv   z-Tuple[List[RowType], Optional[EofPacketType]])r   rV   rv   rB   )FFF)r  rG   r   ra   r   ra   rD  ra   r6  r   rv   rD   )rF  rG   r6  r   rv   z!Generator[ResultType, None, None]rK   )rI  rT   rJ  rT   r6  r   rv   rw   )rM  r^   r6  r   rv   z/Mapping[str, Union[int, List[DescriptionType]]])r}   r}   r   )rI  zUnion[int, CMySQLPrepStmt]rP  zSequence[BinaryProtocolType]rY  r   r  rT   r6  r   rv   z&Optional[Union[Dict[str, Any], Tuple]])rI  rT   r6  r   rv   rw   )rX  rT   rv   rB   )
rI  rT   r[  rT   rP  r   r6  r   rv   rT   )rv   r^   re   )r`  rq  rv   rw   )rv   rF   )re  rT   rv   rB   )rv   r?   )rv   rB   )
r   r   r   Nr   r   r   r   r   r   )rl  rV   r   rV   r   rV   r[   rq  r   rV   r   rV   r   rV   rm  rV   rn  rV   r   rV   rv   zOptional[OkPacketType])lrx   ry   rz   r{   r,   r   r   r   r   r!  r   staticmethodr*  propertyr   r_  r   rd  rf  r   r   setterr   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  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|   r  r7  r  r<  r>  r@  rB  r  rG  rK  rN  rQ  rT  rV  rY  r\  r^  ra  rc  rf  rh  rj  ro  r}   rt   rh   r   r      su   1
 #"&%)&* % #'%'"&&*""',0/3+/IM#89M#N4I(5
 59',"78I"J&;N&K'<_'M%)&* $"&!%*/.3'<^'L,00448cH, H, 	H,
 H, H,  H, H, H, H, H, H, #H, $H, H,  !H," #H,$ !%H,& #'H,(  )H,* $+H,, -H,.  /H,0 1H,2 3H,4 *5H,6  -7H,8 )9H,: G;H,< !=H,> %2?H,D 2EH,F !%GH,H  IH,J $KH,L %MH,N #OH,P $QH,R SH,T  UH,V WH,X (YH,Z ,[H,\ %]H,^ *_H,` .aH,b 2cH,T 37-1-1	/ + +	
 
aXF[
zORb JK  $8 DG 	   D #  #       ! ! 
 
 __
 
 
" 
" % %> 
# 
# & &>
- % % &  &
 $ $   P P / / & & 
 
 
 

! 
 
 
 

 
 
 
 __
 
$$ " " # # ' ' ' '( # # $ $ 	' 	' " " ( (  & __  " "  5 5  :" UY8;08;DQ8;	8;t/0 0)00?OPQ# R# 0)00}MN  O  	 	 
 
     GH14AD	 $ 0)00~NO! P!  " " U U0 0)00?PQR	) S	) % %  $ ! ! . .617"
+"% + +!+F	"   TYJPX $("#'<@%)&*'+   !	
 : # $ % 
 6  37"	 1 	
  
;    $37"  1	
    
7   * * , ,      #  	
   
 (  
+	( -.'*:=	  		 	 
9		 	  .0!202 +2 	2
 2 2 
02 2   
	     6  	
  
*              !%!"$!#,, , 	,
 , , , , ,  , , 
 , ,rt   r   c                     e Zd ZdZ	 	 d(	 	 	 	 	 d)dZd*dZ	 	 	 d+	 	 	 	 	 	 	 d,dZd-dZd.dZe	d/d       Z
e
j                  d0d	       Z
e	d/d
       Zej                  d0d       Ze	d1d       Ze	d2d       Ze	d/d       Ze	d3d       Z e ej&                  d            d3d       Ze	d2d       Ze	d4d       Ze	d5d       Ze	d6d       Zed7d       Ze	 	 d8	 	 	 	 	 	 	 d9d       Ze	 	 d8	 	 	 	 	 	 	 d9d       Ze	 	 	 	 	 	 d:d       Zed;d       Zed<d       Zed=d>d       Z 	 	 d?dZ!ed@d       Z"ed6d        Z# e ej&                  d!            d/d"       Z$dAdBd#Z%dCd$Z&dDd%Z'dEd&Z(dFd'Z)y)Gr   z#Defines the MySQL cursor interface.Nc                X   || _         |j                  | _        d | _        d | _        d | _        d| _        d | _        g | _        g | _	        d| _
        d| _        d| _        d| _        d| _        d | _        d | _        d| _        || _        || _        | j                   j)                  |        y )Nr   Fr2  r{  rK   )_connectionr   r   _description_last_insert_id	_warnings_warning_count	_executed_executed_list_stored_results_binaryr   	_rowcount_nextrow	arraysize_stmt_partitions_stmt_partition_stmt_map_resultsr   r   r!  )rq   
connectionr   r   s       rh   r   zMySQLCursorAbstract.__init__C  s     5?0:
=A.26:#$*.+-*,"	 L
    	 @D',,8-:##D)rt   c                   K   | S wre   r}   r   s    rh   r   zMySQLCursorAbstract.__aenter__f  s        c                @   K   | j                          d {    y 7 wre   r   r   s       rh   r   zMySQLCursorAbstract.__aexit__i  r  r  c                   K   | S w)zIterate over result set.

        Iteration over the result set which calls self.fetchone()
        and returns the next row.
        r}   r   s    rh   	__aiter__zMySQLCursorAbstract.__aiter__q  s      r  c                |   K   	 | j                          d{   }|st        |S 7 # t        $ r t        dw xY ww)zm
        Used for iterating over the result set. Calles self.fetchone()
        to get the next row.
        N)r  r7   StopAsyncIteration)rq   rows     rh   __next__zMySQLCursorAbstract.__next__y  sD     
	/'C $$
 ( 	/$$.	/s    <( &( 
<( 9<c                    | j                   S )a  
        Gets the cursor context's timeout in seconds for each attempt
        to read any data from the server.

        `read_timeout` is number of seconds upto which the connector should wait
        for the server to reply back before raising an ReadTimeoutError. We can set
        this option to None, which would signal the connector to wait indefinitely
        till the read operation is completed or stopped abruptly.
        rq  r   s    rh   r   z MySQLCursorAbstract.read_timeout  rr  rt   c                V    | t        |t              r|dk  rt        d      || _        y)a  
        Sets or updates the cursor context's timeout in seconds for each attempt
        to read any data from the server.

        `read_timeout` is number of seconds upto which the connector should wait
        for the server to reply back before raising an ReadTimeoutError. We can set
        this option to None, which would signal the connector to wait indefinitely
        till the read operation is completed or stopped abruptly.

        Args:
            timeout: Accepts a non-negative integer which is the timeout to be set
                     in seconds or None.
        Raises:
            InterfaceError: If a positive integer or None is not passed via the
                            timeout parameter.
        Examples:
            The following will set the read_timeout of the current session's cursor
            context to 5 seconds:
            ```
            >>> cnx = await mysql.connector.connect(user='scott')
            >>> cur = await cnx.cursor()
            >>> cur.read_timeout = 5
            ```
        Nr   rt  ru  rv  s     rh   r   z MySQLCursorAbstract.read_timeout  s4    4 gs+w{$L  %rt   c                    | j                   S )a  
        Gets the cursor context's timeout in seconds for each attempt
        to send data to the server.

        `write_timeout` is number of seconds upto which the connector should spend to
        write to the server before raising an WriteTimeoutError. We can set this option
        to None, which would signal the connector to wait indefinitely till the write
        operation is completed or stopped abruptly.
        ry  r   s    rh   r   z!MySQLCursorAbstract.write_timeout  rz  rt   c                V    | t        |t              r|dk  rt        d      || _        y)a  
        Sets or updates the cursor context's timeout in seconds for each attempt
        to send data to the server.

        `write_timeout` is number of seconds upto which the connector should spend to
        write to the server before raising an WriteTimeoutError. We can set this option
        to None, which would signal the connector to wait indefinitely till the write
        operation is completed or stopped abruptly.

        Args:
            timeout: Accepts a non-negative integer which is the timeout to be set in
                     seconds or None.
        Raises:
            InterfaceError: If a positive integer or None is not passed via the
                            timeout parameter.
        Examples:
            The following will set the write_timeout of the current session's cursor
            context to 5 seconds:
            ```
            >>> cnx = await mysql.connector.connect(user='scott')
            >>> cur = await cnx.cursor()
            >>> cur.write_timeout = 5
            ```
        Nr   r|  r}  rv  s     rh   r   z!MySQLCursorAbstract.write_timeout  s4    4 gs+w{$M  &rt   c                    | j                   S )a  Return description of columns in a result.

        This property returns a list of tuples describing the columns in in a result
        set. A tuple is described as follows:

                (column_name,
                 type,
                 None,
                 None,
                 None,
                 None,
                 null_ok,
                 column_flags)  # Addition to PEP-249 specs

        Returns a list of tuples.
        )r  r   s    rh   descriptionzMySQLCursorAbstract.description  s    $    rt   c                    | j                   S )a  Return the number of rows produced or affected.

        This property returns the number of rows produced by queries such as a
        SELECT, or affected rows when executing DML statements like INSERT or UPDATE.

        Note that for non-buffered cursors it is impossible to know the number of rows
        produced before having fetched them all. For those, the number of rows will
        be -1 right after execution, and incremented when fetching rows.
        )r  r   s    rh   rowcountzMySQLCursorAbstract.rowcount  s     ~~rt   c                    | j                   S )zGets the value generated for an AUTO_INCREMENT column by the previous
        INSERT or UPDATE statement or None when there is no such value available.
        r  r   s    rh   	lastrowidzMySQLCursorAbstract.lastrowid  s    
 ###rt   c                    | j                   S )zGets warnings.r  r   s    rh   warningszMySQLCursorAbstract.warnings
       ~~rt   r  r  c                    | j                   S )zReturns Warnings.r  r   s    rh   fetchwarningsz!MySQLCursorAbstract.fetchwarnings  r  rt   c                    | j                   S )zReturn the number of warnings.

        This property returns the number of warnings generated by the previously
        executed operation.
        )r  r   s    rh   warning_countz!MySQLCursorAbstract.warning_count  r  rt   c                f    | j                   s
t               S t        d | j                   D              S )z[Returns column names.

        This property returns the columns names as a tuple.
        c              3  &   K   | ]	  }|d      yw)r   Nr}   )rf   ds     rh   ri   z3MySQLCursorAbstract.column_names.<locals>.<genexpr>%  s     4aQqT4s   )r  ro   r   s    rh   column_namesz MySQLCursorAbstract.column_names  s+     7N44#3#3444rt   c                    | j                   y	 | j                   j                         j                  d      S # t        t        f$ r+ t        t        | j                   j                               cY S w xY w)a  Returns the latest executed statement.

        When a multiple statement is executed, the value of `statement`
        corresponds to the one that caused the current result set, provided
        the statement-result mapping was enabled. Otherwise, the value of
        `statement` matches the statement just as provided when calling
        `execute()` and it does not change as result sets are traversed.
        Nzutf-8)r  r  decoder  UnicodeDecodeErrorr    rV   r   s    rh   rM  zMySQLCursorAbstract.statement'  sc     >>!	5>>'')0099 23 	5T^^11344	5s   (8 7A21A2c                ,    t        | j                        S )zReturns whether the cursor could have rows returned.

        This property returns True when column descriptions are available and possibly
        also rows, which will need to be fetched.
        )ra   r  r   s    rh   	with_rowszMySQLCursorAbstract.with_rows8  s     D%%&&rt   c                     y)zReturns an iterator for stored results.

        This method returns an iterator over results which are stored when callproc()
        is called. The iterator will provide MySQLCursorBuffered instances.
        Nr}   r   s    rh   stored_resultsz"MySQLCursorAbstract.stored_resultsA  r`  rt   c                   K   yw)a  Executes the given operation (a MySQL script) substituting any markers
        with the given parameters.

        For example, getting all rows where id is 5:
        ```
        cursor.execute("SELECT * FROM t1 WHERE id = %s", (5,))
        ```

        If you want each single statement in the script to be related
        to its corresponding result set, you should enable the `map_results`
        switch - see workflow example below.

        If the given script uses `DELIMITER` statements (which are not recognized
        by MySQL Server), the connector will parse such statements to remove them
        from the script and substitute delimiters as needed. This pre-processing
        may cause a performance hit when using long scripts. Note that when enabling
        `map_results`, the script is expected to use `DELIMITER` statements in order
        to split the script into multiple query strings.

        The following characters are currently not supported by the connector in
        `DELIMITER` statements: `"`, `'`, #`, `/*` and `*/`.

        If warnings were generated, and `connection.get_warnings` is
        `True`, then `self.warnings` will be a list containing these
        warnings.

        Args:
            operation: Operation to be executed - it can be a single or a
                       multi statement.
            params: The parameters found in the tuple or dictionary params are bound
                    to the variables in the operation. Specify variables using `%s` or
                    `%(name)s` parameter style (that is, using format or pyformat style).
            map_results: It is `False` by default. If `True`, it allows you to know what
                        statement caused what result set - see workflow example below.
                        Only relevant when working with multi statements.

        Returns:
            `None`.

        Example (basic usage):
            The following example runs many single statements in a
            single go and loads the corresponding result sets
            sequentially:

            ```
            sql_operation = '''
            SET @a=1, @b='2024-02-01';
            SELECT @a, LENGTH('hello'), @b;
            SELECT @@version;
            '''
            async with await cnx.cursor() as cur:
                await cur.execute(sql_operation)

                result_set = await cur.fetchall()
                # do something with result set
                ...

                while (await cur.nextset()):
                    result_set = await cur.fetchall()
                    # do something with result set
                    ...
            ```

            In case the operation is a single statement, you may skip the
            looping section as no more result sets are to be expected.

        Example (statement-result mapping):
            The following example runs many single statements in a
            single go and loads the corresponding result sets
            sequentially. Additionally, each result set gets related
            to the statement that caused it:

            ```
            sql_operation = '''
            SET @a=1, @b='2024-02-01';
            SELECT @a, LENGTH('hello'), @b;
            SELECT @@version;
            '''
            async with await cnx.cursor() as cur:
                await cur.execute(sql_operation, map_results=True)

                # statement 1 is `SET @a=1, @b='2024-02-01'`,
                # result set from statement 1 is `[]` - aka, an empty set.
                result_set, statement = await cur.fetchall(), cur.statement
                # do something with result set
                ...

                # 1st call to `nextset()` will laod the result set from statement 2,
                # statement 2 is `SELECT @a, LENGTH('hello'), @b`,
                # result set from statement 2 is `[(1, 5, '2024-02-01')]`.
                #
                # 2nd call to `nextset()` will laod the result set from statement 3,
                # statement 3 is `SELECT @@version`,
                # result set from statement 3 is `[('9.0.0-labs-mrs-8',)]`.
                #
                # 3rd call to `nextset()` will return `None` as there are no more sets,
                # leading to the end of the consumption process of result sets.
                while (await cur.nextset()):
                    result_set, statement = await cur.fetchall(), cur.statement
                    # do something with result set
                    ...
            ```

            In case the mapping is disabled (`map_results=False`), all result
            sets get related to the same statement, which is the one provided
            when calling `execute()`. In other words, the property `statement`
            will not change as result sets are consumed, which contrasts with
            the case in which the mapping is enabled. Note that we offer a
            new fetch-related API command which can be leveraged as a shortcut
            for consuming result sets - it is equivalent to the previous
            workflow.

            ```
            sql_operation = '''
            SET @a=1, @b='2024-02-01';
            SELECT @a, LENGTH('hello'), @b;
            SELECT @@version;
            '''
            async with await cnx.cursor() as cur:
                await cur.execute(sql_operation, map_results=True)
                async for statement, result_set in cur.fetchsets():
                    # do something with result set
            ```
        Nr}   rq   	operationparamsmap_resultss       rh   r  zMySQLCursorAbstract.executeI  r  r  c                   K   yw)a  Executes the given operation (it can be a multi statement
        or a MySQL script) substituting any markers with the given parameters.

        **NOTE: `executemulti()` is deprecated and will be removed in a
        future release. Use `execute()` instead.**

        If you want each single statement in the script to be related
        to its corresponding result set, you should enable the `map_results`
        switch - see workflow example below. This capability reduces performance.

        **Unexpected behavior might happen if your script includes the following
        symbols as delimiters `"`, `'`, `#`, `/*` and `*/`. The use of these should
        be avoided for now**.

        Refer to the documentation of `execute()` to see the multi statement execution
        workflow.

        Args:
            operation: Operation to be executed - it can be a single or a
                       multi statement.
            params: The parameters found in the tuple or dictionary params are bound
                    to the variables in the operation. Specify variables using `%s` or
                    `%(name)s` parameter style (that is, using format or pyformat style).
            map_results: It is `False` by default. If `True`, it allows you to know what
                        statement caused what result set - see workflow example below.
                        Only relevant when working with multi statements.

        Returns:
            `None`.
        Nr}   r  s       rh   executemultiz MySQLCursorAbstract.executemulti  r  r  c                   K   yw)a=  Prepare and execute a MySQL Prepared Statement many times.

        This method will prepare the given operation and execute with each tuple found
        the list seq_params.

        If the cursor instance already had a prepared statement, it is first closed.

        executemany() simply calls execute().
        Nr}   )rq   r  
seq_paramss      rh   executemanyzMySQLCursorAbstract.executemany  r  r  c                   K   yw)zReturn next row of a query result set.

        Raises:
            InterfaceError: If there is no result to fetch.

        Returns:
            tuple or None: A row from query result set.
        Nr}   r   s    rh   r  zMySQLCursorAbstract.fetchone	  r  r  c                   K   yw)zReturn all rows of a query result set.

        Raises:
            InterfaceError: If there is no result to fetch.

        Returns:
            list: A list of tuples with all rows of a query result set.
        Nr}   r   s    rh   fetchallzMySQLCursorAbstract.fetchall	  r  r  c                   K   yw)a<  Return the next set of rows of a query result set.

        When no more rows are available, it returns an empty list.
        The number of rows returned can be specified using the size argument, which
        defaults to one.

        Returns:
            list: The next set of rows of a query result set.
        Nr}   )rq   sizes     rh   	fetchmanyzMySQLCursorAbstract.fetchmany	  r  r  c                 K   d}| j                   s| j                  }	 | j                          d{   }| j                   r| j                  n||f | j	                          d{   rR	 | j                          d{   }| j                   r| j                  n||f | j	                          d{   rQyy7 # t        $ r g }Y w xY w7 j7 S# t        $ r g }Y ^w xY w7 /w)a  Generates the result sets stream caused by the last `execute*()`.

        Returns:
            A 2-tuple; the first element is the statement that caused the
            result set, and the second is the result set itself.

        Example:
            Consider the following example where multiple statements are executed in one
            go:

            ```
                sql_operation = '''
                SET @a=1, @b='2024-02-01';
                SELECT @a, LENGTH('hello'), @b;
                SELECT @@version;
                '''
                async with await cnx.cursor() as cur:
                    await cur.execute(sql_operation, map_results=True)

                    result_set, statement = await cur.fetchall(), cur.statement
                    # do something with result set
                    ...

                    while (await cur.nextset()):
                        result_set, statement = await cur.fetchall(), cur.statement
                        # do something with result set
                        ...
            ```

            In this case, as an alternative to loading the result sets with `nextset()`
            in combination with a `while` loop, you can use `fetchsets()` which is
            equivalent to the previous approach:

            ```
                sql_operation = '''
                SET @a=1, @b='2024-02-01';
                SELECT @a, LENGTH('hello'), @b;
                SELECT @@version;
                '''
                async with await cnx.cursor() as cur:
                    await cur.execute(sql_operation, map_results=True)
                    async for statement, result_set in cur.fetchsets():
                        # do something with result set
            ```
        N)r  rM  r  r7   nextset)rq   statement_cached
result_sets      rh   	fetchsetszMySQLCursorAbstract.fetchsets%	  s     h  %%#~~	#}}.J #44DNN:J 	 LLN"" #'==?2
 #'"8"8>N  LLN"" / 	J	
 #2!  
  #s   C*C C C 2C*(C)C*.C CC 2C*8C(9C*>C* C CC*CC*C C%"C*$C%%C*c                   K   yw)aK  Makes the cursor skip to the next available set, discarding
        any remaining rows from the current set.

        This method should be used as part of the multi statement
        execution workflow - see example below.

        Returns:
            It returns `None` if there are no more sets. Otherwise, it returns
            `True` and subsequent calls to the `fetch*()` methods will return
            rows from the next result set.

        Example:
            The following example runs many single statements in a
            single go and loads the corresponding result sets
            sequentially:

            ```
            sql_operation = '''
            SET @a=1, @b='2024-02-01';
            SELECT @a, LENGTH('hello'), @b;
            SELECT @@version;
            '''
            async with await cnx.cursor() as cur:
                await cur.execute(sql_operation)

                result_set = await cur.fetchall()
                # do something with result set
                ...

                while (await cur.nextset()):
                    result_set = await cur.fetchall()
                    # do something with result set
                    ...
            ```

            In case the operation is a single statement, you may skip the
            looping section as no more result sets are to be expected.
        Nr}   r   s    rh   r  zMySQLCursorAbstract.nextsetm	  r  r  c                   K   yw)zClose the cursor.Nr}   r   s    rh   r   zMySQLCursorAbstract.close	  r  r  r  c                    | j                   S )zReturn the value generated for an AUTO_INCREMENT column.

        Returns the value generated for an AUTO_INCREMENT column by the previous
        INSERT or UPDATE statement.
        r  r   s    rh   getlastrowidz MySQLCursorAbstract.getlastrowid	  s     ###rt   c                   K   yw)zReset the cursor to default.Nr}   )rq   frees     rh   resetzMySQLCursorAbstract.reset	  r  r  c                H    t        | d      r| j                  j                  S y)zGets a list of query attributes from the connector's side.

        Returns:
            List of existing query attributes.
        r  N)hasattrr  r  r   s    rh   get_attributesz"MySQLCursorAbstract.get_attributes	  s#     4'##///rt   c                    t        |t              st        d      |t        |t              st        d| d      | j                  j                  ||f       y)a  Add a query attribute and its value into the connector's query attributes.

        Query attributes must be enabled on the server - they are disabled by default. A
        warning is logged when setting query attributes for a server connection
        that does not support them.

        Args:
            name: Key name used to identify the attribute.
            value: A value converted to the MySQL Binary Protocol.

        Raises:
            ProgrammingError: If the value's conversion fails.
        &Parameter `name` must be a string typeNzObject z$ cannot be converted to a MySQL type)r  rV   r:   r%   r  r  )rq   r  r9  s      rh   add_attributez!MySQLCursorAbstract.add_attribute	  s]     $$"#KLLZ~%F"% DE  	++T5M:rt   c                n    t        |t              st        d      | j                  j	                  |      S )a'  Removes a query attribute by name from the connector's query attributes.

        If no match, `None` is returned, else the corresponding value is returned.

        Args:
            name: Key name used to identify the attribute.

        Returns:
            value: Attribute's value.
        r  )r  rV   r:   r  r  r  s     rh   remove_attributez$MySQLCursorAbstract.remove_attribute	  s1     $$"#KLL22488rt   c                8    | j                   j                          y)z<Clears the list of query attributes on the connector's side.N)r  r  r   s    rh   clear_attributesz$MySQLCursorAbstract.clear_attributes	  s    **,rt   r{  )r  r   r   rq  r   rq  )rv   r   rt  ru  )rv   zIterator[RowType])rv   rE   rv  ry  )rv   r  rw  )rv   zOptional[List[WarningType]])rv   zTuple[str, ...]rx  rz  )rv   zIterator[MySQLCursorAbstract])r}   F)r  rV   r  z$Union[Sequence[Any], Dict[str, Any]]r  ra   rv   rw   )r  rV   r  zSequence[ParamsSequenceType]rv   rw   )rv   r~  )rv   zList[RowType]r  )r  rT   rv   zList[Sequence[Any]])rv   z9AsyncGenerator[tuple[Optional[str], list[RowType]], None])rv   rr  )T)r  ra   rv   r   )rv   z.Optional[List[Tuple[str, BinaryProtocolType]]])r  rV   r9  r=   rv   rw   r}  ru   )*rx   ry   rz   r{   r   r   r   r  r  r  r   r  r   r  r  r  r  r"   r-   r)  r  r  r  rM  r  r   r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r}   rt   rh   r   r   @  s"   -
 '+'+	!*+!* $!* %	!*F
 37-1-1	/ + +	
 
 
" 
" % %@ 
# 
# & &@ ! !& 
 
 $ $   0)00zJK L # # 5 5 5 5  ' '    8:!	AA 5A 	A
 
A AF  8:!	## 5# 	#
 
# #J  1 
	      	 	F	BFP & &P     0)00{KL$ M$+;,9-rt   r   c                      e Zd ZdZy)CMySQLPrepStmtaP  Structure to represent a result from `CMySQLConnection.cmd_stmt_prepare`.
    It can be used consistently as a type hint.

    `_mysql_connector.MySQLPrepStmt` isn't available when the C-ext isn't built.

    In this regard, `CmdStmtPrepareResult` acts as a proxy/wrapper entity for a
    `_mysql_connector.MySQLPrepStmt` instance.
    N)rx   ry   rz   r{   r}   rt   rh   r  r  	  s    rt   r  )fr{   
__future__r   __all__r   r  rl   r   abcr   r   dataclassesr	   r
   inspectr   typesr   typingr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    _decoratingr"   	abstractsr#   r$   r%   r&   r'   r(   r)   r*   	constantsr+   r,   r-   r.   r/   r0   r1   r2   r3   
conversionr4   r5   errorsr6   r7   r8   r9   r:   tls_ciphersr;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   utilsrI   rJ   authenticationrL   rN   rM   rU   rO   networkrP   rQ   r  r  r   r   r   r  r}   rt   rh   <module>r     s   @ 2 "
J  	 	  # (       . %	 	 	
 
 
 <  S    2 . ' #8 77g % % %D[c [|4W
-# W
-t^ rt   