
    G)f;                   d   U 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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# d
dl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ d
dl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 d
dl4m5Z5m6Z6 d
dl7m8Z8m9Z9m:Z:m;Z;m<Z< d
dlm=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZG d
dlHmIZImJZJ ddlKmLZL ddlMmNZNmMZM ddlOmPZP erddlQmRZRmSZS ej                  dk(  ZU ej                         ZWdeXd<   e G d d             ZY G d de
      ZZ G d de
      Z[ G d d eI      Z\y)!z+Module gathering all abstract base classes.    )annotations)MySQLConnectionAbstractMySQLCursorAbstract
ServerInfoN)ABCabstractmethod)	dataclassfield)	signature)TracebackType)TYPE_CHECKINGAnyAsyncGeneratorBinaryIOCallableDict	GeneratorIteratorListMappingNoReturnOptionalSequenceTupleTypeUnion   )DUPLICATED_IN_LIST_ERRORKRB_SERVICE_PINCIPAL_ERRORMYSQL_PY_TYPESTLS_V1_3_SUPPORTEDTLS_VER_NO_SUPPORTEDTLS_VERSION_DEPRECATED_ERRORTLS_VERSION_ERROR)CONN_ATTRS_DNDEFAULT_CONFIGURATIONDEPRECATED_TLS_VERSIONSOPENSSL_CS_NAMESTLS_CIPHER_SUITESTLS_VERSIONS
ClientFlag)MySQLConverterMySQLConverterBase)ErrorInterfaceErrorInternalErrorNotSupportedErrorProgrammingError)BinaryProtocolTypeDescriptionTypeEofPacketTypeHandShakeTypeOkPacketTypeParamsSequenceType
ResultTypeRowTypeStatsPacketType
StrOrBytesWarningType)GenericWrapperimport_object   )MySQLAuthenticator)Charsetcharsets)MySQLProtocol)MySQLTcpSocketMySQLUnixSocketposixz%weakref.WeakValueDictionary[Any, Any]NAMED_TUPLE_CACHEc                      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)rJ   ).0vs     Z/var/www/html/flask-app/venv/lib/python3.12/site-packages/mysql/connector/aio/abstracts.py	<genexpr>z+ServerInfo.__post_init__.<locals>.<genexpr>   s     <1A<s   r      )   r@   zMySQL Version 'z' is not supportedN)recompilematchrM   r/   tuplegroupsrO   )self
version_rerd   rM   s       r^   __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
   rO   rX   ri    rj   r^   r   r   w   sT    
 ML%*%6M?6NL%*d*%rj   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	   dddddded
   g dd)	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 didZdjdZ	 	 	 dk	 	 	 	 	 	 	 dldZdmdZdmdZ	dmdZ
e	 dn	 	 	 	 	 	 	 dod       Zeedpd              Zedqd       Zedqd       Zedrd       Zedsd       Zedqd       Zej*                  dtd       ZdqdZdtdZedud       Zej*                  dvd       Zedud       Zedwd       Zedud        Zedxd!       Zedud"       Zedud#       Zej*                  dvd$       Zdud%Zdvd&Z edqd'       Z!e!j*                  dtd(       Z!dqd)Z"dtd*Z#edqd+       Z$e$j*                  dyd,       Z$dqd-Z%dyd.Z&edud/       Z'e'j*                  dvd0       Z'edud1       Z(e(j*                  dvd2       Z(edud3       Z)e)j*                  dvd4       Z)edqd5       Z*edqd6       Z+edmd7       Z,edzd8       Z-dmd9Z.	 d{	 	 	 	 	 d|d:Z/d}d;Z0d~d<Z1djd=Z2dd>Z3dsd?Z4edud@       Z5edudA       Z6e	 d	 	 	 	 	 	 	 ddB       Z7ddCZ8ddDZ9ddEZ:ddFZ;dmdGZ<dmdHZ=dmdIZ>ddJZ?ddKZ@ddLZAedmdM       ZBdddNZCddOZDedmdP       ZEeEZFdQeGdR<   e	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 ddS       ZHe	 	 	 d	 	 	 	 	 	 	 ddT       ZIe	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddU       ZJedmdV       ZKedmdW       ZLedudX       ZMeddY       ZNe	 	 	 d	 	 	 	 	 	 	 	 	 ddZ       ZO	 	 	 	 dd[ZPeddd\       ZQe	 	 	 	 dd]       ZRe	 	 	 d	 	 	 	 	 	 	 	 	 dd^       ZSedd_       ZTedd`       ZUedda       ZV	 	 	 	 	 	 	 	 ddbZWeddc       ZXedddd       ZYedde       ZZeddf       Z[eddg       Z\eddh       Z]y)r   z'Defines the MySQL connection interface.N z	127.0.0.1i  Fallow_local_infileallow_local_infile_in_pathconnect_timeoutssl_disabled))userpasswordhostportdatabase	password1	password2	password3rQ   	collationrS   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fido_callbackwebauthn_callbackrv   rw   converter_classconverter_str_fallbackconnection_timeoutunix_socketssl_cassl_certssl_keyssl_verify_certssl_verify_identityry   tls_versionsloopc       )           || _         || _        || _        || _        || _        || _        || _        || _        |!| _        | | _	        || _
        || _        || _        || _        || _        || _        || _        t#               | _        d | _        d | _        |	| _        |
| _        d| _        |'| _        |"| _        |#| _        |$| _        |%| _        |&| _        |(| _        g | _        || _         d | _!        d | _"        |)xs tG        jH                         | _%        |xs tM        jN                         | _(        |  tS        jT                         | _+        i | _,        d| _-        g | _.        t_               | _0        |xs tb        | _2        || _3        || _4        || _5        || _6        || _7        || _8        || _9        || _:        || _;        d| _<        d| _=        d| _>        d| _?        d | _@        d | _A        || _B        || _C        d | _D        | j                          y )NFT)F_user	_password_host_port	_database
_password1
_password2
_password3_unix_socket_connection_timeout_connection_attrs	_compress_consume_results_autocommit
_time_zone	_sql_mode_init_commandrD   	_protocol_socket_charset_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_loopr+   get_default_client_flagsweakrefWeakSet_cursors_query_attrs_query_attrs_supported_columns_descrA   _authenticatorr,   _converter_class_converter_str_fallback_kerberos_auth_mode_krb_service_principal_allow_local_infile_allow_local_infile_in_path_get_warningsr   	_buffered_raw_have_next_result_unread_result_use_unicode_in_transaction_oci_config_file_oci_config_profile_fido_callback_webauthn_callback	converter_validate_connection_options)*rg   rz   r{   r|   r}   r~   r   r   r   rQ   r   rS   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rv   rw   r   r   r   r   r   r   r   r   r   ry   r   r   s*                                             r^   __init__z MySQLConnectionAbstract.__init__   s   ^ 
&

&(((!,(: 1;'&5!+)2(0,8(5IM+/,31:!&#/&,(0'.0?4G!2>68+61537,G**, 	
 #/"J*2H2H2J)0):;=+0#462D2F6E6W-C$2D 5J#); :T(#/'8'	',$)"&%*/326 KX  	 48))+rj   c                b   K   | j                         s| j                          d {    | S 7 wr[   )is_socket_connectedconnectrg   s    r^   
__aenter__z"MySQLConnectionAbstract.__aenter__  s+     ''),,.   !s   $/-/c                @   K   | j                          d {    y 7 wr[   closerg   exc_type	exc_value	tracebacks       r^   	__aexit__z!MySQLConnectionAbstract.__aexit__        jjl   c                   | j                   r 	 | j                   j                         | _         | j                  r | j	                  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!| j	                  t
        j                  g       n!| j	                  t
        j                   g       | j                   dk(  rt#        d| j                    d      | j$                  rt        j&                  dk(  rd| _        | j(                  r| 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:                  r| j=                          | j>                  r| 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                  r9d)}te        jf                  |th               | jk                  d*| jb                  d+       | jl                  r| jk                  d,| jl                  d+       yy# t        $ r}t        d      |d}~ww xY w)-z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 pluginrG   Tmysql_clear_passwordzFClear password 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)errorru   zcan not be an empty string/zis incorrectly formattedzThe `fido_callback` connection argument is deprecated and it will be removed in a future release of MySQL Connector/Python. Use `webauth_callback` insteadr   r@   webauth_callback)7r   stripAttributeErrorr   set_client_flagsr+   COMPRESSr   ospathabspathexistsisdirislinkr   LOCAL_FILESr   r/   r   namer   
isinstancer   rJ   anyr   r   r   allr   _validate_tls_versionsr   _validate_tls_ciphersuitesr   dictitemsr%   rL   len
startswithr   CONNECT_ARGS_add_default_conn_attrsr   lowerr   r   r   formatr   warningswarnDeprecationWarning_validate_callabler   )rg   errinfile_in_path	attr_name
attr_valuer   warn_msgs          r^   r   z4MySQLConnectionAbstract._validate_connection_options  s	   ::I!ZZ--/
 >>!!:#6#6"78++WW__T-M-MNNGGNN>2n577>>.1$%UVV##t'G'G!!:#9#9":;!!J$:$:#:";<  @@ D%%& '   G!3!%D$"3"37M"M  
 $**c* !JKKdnndmm<=t~~67$P  %4>>T+AB$J  !!++-%%//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?$.55<MN  **b0$.55: 
 $555$.55<VW  1 
 MM($67##OT5H5H!L""##$68O8OQRS #U " I$%>?SHIs   U% %	U?.U::U?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j-                  |d         dj-                  |d         g| _         y
c c}w )z&Validates the tls_ciphersuites option.[]z)tls_ciphersuites must be a list, found: 'r   r@   ,z6No valid cipher suite found in 'tls_ciphersuites' listzItls_ciphersuites should be a list with one or more ciphersuites. Found: 'NT)reverser   -TLSv1.3tls_ciphersuiteslistvaluezThe value 'z1' in tls_ciphersuites is not a valid cipher suitez:No valid cipher suite found in the 'tls_ciphersuites' list:)r   r
  rL   r  endswithr   splitr   upperappendr*  setr   r*   sortindexupdater)   extendr(   r   r  join)rg   r(  tls_cstls_css_tls_csr   newer_tls_vertranslated_namesiani_cipher_suites_namesossl_cipher_suites_namestls_verr	  translated_names                r^   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 
 HH%a()HH%a()"
o  Gs   I7I7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 |rG|dgk(  r)t        s#t%        t        j                  |t                    |j'                          || _         y|r#t%        t)        j                  |t                    |r#t        t+        j                  t                    y)z"Validates the tls_versions option.r!  r"  z%tls_versions must be a list, found: 'r   r@   r#  r$  ru   r   r)  r'  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
  rL   r  r-  r   r.  r   r   r  r0  r!   r"   r*   r*  r1  r6  r'   r1   r2  r#   r$   )rg   r   tls_versiontls_versr>  use_tls_versionsdeprecated_tls_versionsinvalid_tls_versionss           r^   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11'..w7$++G4	5 I;.7I'(//\J  !!#!1D$#,33+\ 
 " !2!9!9'<!PQQ "rj   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
  rL   r?   
ValueErrorr2   callabler  r   
parameters)option_namecallbacknum_argsr  
num_paramss        r^   r  z*MySQLConnectionAbstract._validate_callableS  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.Nrs   r   s    r^   connection_idz%MySQLConnectionAbstract.connection_idv      rj   c                    | j                   S )z$User used while connecting to MySQL.)r   r   s    r^   rz   zMySQLConnectionAbstract.user{       zzrj   c                    | j                   S )z MySQL server IP address or name.)r   r   s    r^   server_hostz#MySQLConnectionAbstract.server_host  rR  rj   c                    | j                   S )zMySQL server TCP/IP port.)r   r   s    r^   server_portz#MySQLConnectionAbstract.server_port  rR  rj   c                    | j                   S )z MySQL Unix socket file location.)r   r   s    r^   r   z#MySQLConnectionAbstract.unix_socket  s        rj   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r2   r   s    r^   r~   z MySQLConnectionAbstract.database  s     E
 	
rj   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 insteadrZ  rg   r+  s     r^   r~   z MySQLConnectionAbstract.database       I
 	
rj   c                J   K   | j                  d       d{   }|d   S 7 	w)rY  zSELECT DATABASE()Nr   
info_query)rg   results     r^   get_databasez$MySQLConnectionAbstract.get_database  s'     ':;;ay <   #!
#c                H   K   | j                  d|        d{    y7 w)r\  zUSE N)	cmd_queryr]  s     r^   set_databasez$MySQLConnectionAbstract.set_database  s     nntE7^,,,s   " "c                    | j                   S )z"Returns whether to consume results)r   r   s    r^   can_consume_resultsz+MySQLConnectionAbstract.can_consume_results  s     $$$rj   c                6    t        |t              sJ || _        y)zSet if can consume results.N)r
  rW   r   r]  s     r^   ri  z+MySQLConnectionAbstract.can_consume_results  s     %&& %rj   c                    | j                   S )z(MySQL session has started a transaction.)r   r   s    r^   in_transactionz&MySQLConnectionAbstract.in_transaction  s     ###rj   c                    | j                   S )zReturn the event loop.)r   r   s    r^   r   zMySQLConnectionAbstract.loop  rR  rj   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    r^   	is_securez!MySQLConnectionAbstract.is_secure  s%     OD$5$5T$A$NhOrj   c                H    t        | j                  j                               S )zReturns query attributes list.)r*  r   r  r   s    r^   query_attrsz#MySQLConnectionAbstract.query_attrs  s     D%%++-..rj   c                    | j                   S )zReturn if have next result.)r   r   s    r^   have_next_resultz(MySQLConnectionAbstract.have_next_result  s     %%%rj   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 insteadrZ  r   s    r^   r   z"MySQLConnectionAbstract.autocommit  r^  rj   c                    t        d      )Toggle autocommit.zxThe use of async properties are not supported by Python. Use `await set_autocommit(value)` to set the autocommit insteadrZ  r]  s     r^   r   z"MySQLConnectionAbstract.autocommit       N
 	
rj   c                P   K   | j                  d       d{   }|d   dk(  S 7 w)rv  zSELECT @@session.autocommitNr   r@   r`  r]  s     r^   get_autocommitz&MySQLConnectionAbstract.get_autocommit  s,     oo&CDDQx1} Es   &$&c                b   K   |rdnd}| j                  d|        d{    || _        y7 w)rx  ONOFFzSET @@session.autocommit = N)rf  r   )rg   r+  switchs      r^   set_autocommitz&MySQLConnectionAbstract.set_autocommit  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 insteadrZ  r   s    r^   r   z!MySQLConnectionAbstract.time_zone  s     G
 	
rj   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 insteadrZ  r]  s     r^   r   z!MySQLConnectionAbstract.time_zone  ry  rj   c                J   K   | j                  d       d{   }|d   S 7 	w)r  zSELECT @@session.time_zoneNr   r`  r]  s     r^   get_time_zonez%MySQLConnectionAbstract.get_time_zone  s'     oo&BCCQx Drd  c                X   K   | j                  d| d       d{    || _        y7 w)r  zSET @@session.time_zone = 'r   N)rf  r   r]  s     r^   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 insteadrZ  r   s    r^   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 insteadrZ  r]  s     r^   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   ra  r   s    r^   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  r$  zSET @@session.sql_mode = 'r   N)r
  r*  re   r6  rf  r   r]  s     r^   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    r^   r   z$MySQLConnectionAbstract.get_warnings4  s     !!!rj   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
  rW   rG  r   r]  s     r^   r   z$MySQLConnectionAbstract.get_warnings<  s"     %&677"rj   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    r^   r   z)MySQLConnectionAbstract.raise_on_warningsJ  s     &&&rj   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
  rW   rG  r  r   r]  s     r^   r   z)MySQLConnectionAbstract.raise_on_warningsS  s2     %&677"'!&D rj   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    r^   unread_resultz%MySQLConnectionAbstract.unread_resulth       """rj   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
  rW   rG  r   r]  s     r^   r  z%MySQLConnectionAbstract.unread_resultq  s"     %&677#rj   c                J    | j                   r| j                   j                  S d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.
        utf8r   r	  r   s    r^   rQ   zMySQLConnectionAbstract.charset  s     &*]]t}}!!>>rj   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binaryr  r  r   s    r^   python_charsetz&MySQLConnectionAbstract.python_charset  s9     == DMM$6$6 ;
 %

 }}!!!rj   c                     y)z&Add the default connection attributes.Nrs   r   s    r^   r  z/MySQLConnectionAbstract._add_default_conn_attrs  rP  rj   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.
        Nrs   )rg   querys     r^   _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.
        N)set_charset_collationr   
charset_idr  r   r   r  r   r  r   r  r   s    r^   _post_connectionz(MySQLConnectionAbstract._post_connection  s      (()A)ABBB!!$"2"2333??$$T__555>>##DNN333%%d&8&8999  	C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                  j                  | _        | j                  j                  | _        | j!                  d| j                  j                   d| j                  j                   d       d{    	 | j#                  | j                  j                         | j&                  r0| j&                  j)                  | j                  j                         yy7 g# t$        $ r Y Jw xY w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 NoneNrQ   z)collation should be either string or NonezSET NAMES 'z' COLLATE 'r   )r
  rJ   rL   rG  r  rC   	get_by_idr	  get_by_name_and_collationr   get_by_nameget_by_collationr&   r   r   r   rf  set_character_set_namer   r   set_charset)rg   rQ   r   err_msgcharset_strs        r^   r  z-MySQLConnectionAbstract.set_charset_collation  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!]]//"&--"9"9nn$--,,-[9P9P8QQRS
 	
 	
	''(:(:;
 >>NN&&t}}'9'9: 	
  		s6   GI	H8I	%H: ;>I	:	II	II	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   )rg   flags     r^   isset_client_flagz)MySQLConnectionAbstract.isset_client_flag  s     ""T)Q..rj   c                    || _         y)zySet the path that user can upload files.

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

        This method is used when the original object is needed when using
        weakref.proxy.
        rs   r   s    r^   get_selfz MySQLConnectionAbstract.get_self  s	     rj   c                .    | j                   j                  S )zGets the MySQL version.

        Returns:
            The MySQL server version as a tuple. If not previously connected, it will
            return `None`.
        )_server_inforM   r   s    r^   get_server_versionz*MySQLConnectionAbstract.get_server_version  s       (((rj   c                L    	 | j                   d   S # t        t        f$ r Y yw xY w)zGets the original MySQL version information.

        Returns:
            The original MySQL server as text. If not previously connected, it will
            return `None`.
        server_version_originalN)r   	TypeErrorKeyErrorr   s    r^   get_server_infoz'MySQLConnectionAbstract.get_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.
        Nrs   r   s    r^   r   z+MySQLConnectionAbstract.is_socket_connected(  rP  rj   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.
        Nrs   r   s    r^   is_connectedz$MySQLConnectionAbstract.is_connected0  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.
        Nrs   )rg   	reconnectattemptsdelays       r^   pingzMySQLConnectionAbstract.ping9  r  r  c                .   t        |t              r|dkD  r|| _        | j                  S t        |t        t        f      rM|D ]<  }|dk  r | xj                  t        |       z  c_        (| xj                  |z  c_        > | j                  S t        d      )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.

        set_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+set_client_flags expect integer (>0) or set)r
  rJ   r   re   r*  absr2   )rg   flagsr  s      r^   r   z(MySQLConnectionAbstract.set_client_flagsL  s     eS!eai!&D !!! t}- /!8&&3t9*4&&&$.&	/ !!! ##PQQrj   c                    |r_t        |t              rO|| _         || j                  j                  | j
                        | _        | j                  | j                  _        yt        d      )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`.
        zAConverter class should be a subclass of conversion.MySQLConverterN)

issubclassr-   r   r   r	  r   r   r   str_fallbackr  )rg   	convclasss     r^   set_converter_classz+MySQLConnectionAbstract.set_converter_classe  sY     I/AB$-D!&t}}'9'94;L;LMDN*.*F*FDNN'S rj   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   )rg   r+  r  r  s       r^   query_attrs_appendz*MySQLConnectionAbstract.query_attrs_appendw  s1     !&	:D---+5Di( .rj   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rg   r	  s     r^   query_attrs_removez*MySQLConnectionAbstract.query_attrs_remove  s       $$T400rj   c                    i | _         y)z5Clears query attributes list on the connector's side.Nr  r   s    r^   query_attrs_clearz)MySQLConnectionAbstract.query_attrs_clear  s
    rj   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  r0   r   s    r^   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    r^   r   z'MySQLConnectionAbstract.consume_results  s&     --/!! !s    +)+c                  K   | j                  d       d{   4 d{   }|j                  |       d{    |j                          d{   cddd      d{    S 7 O7 H7 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executefetchone)rg   r  r  s      r^   ra  z"MySQLConnectionAbstract.info_query  sx     d33 	+ 	+v..'''**	+ 	+ 	+3 	+'*	+ 	+ 	+ 	+sv   BA(BA*BA2A,A2A.A2B"A0#B*B,A2.A20B2B8A;9B Bc                :    | j                   j                  |       y)zAdd cursor to the weakref set.N)r   addrg   r  s     r^   
add_cursorz"MySQLConnectionAbstract.add_cursor  s    &!rj   c                :    | j                   j                  |       y)z#Remove cursor from the weakref set.N)r   remover  s     r^   remove_cursorz%MySQLConnectionAbstract.remove_cursor  s    V$rj   c                   K   yw)zConnect to the MySQL server.Nrs   r   s    r^   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   r@   Nz!Can not reconnect to MySQL after z attempt(s): )
disconnectr   r  r.   IOErrorr/   r   sleep)rg   r  r  counterr  msgs         r^   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    r^   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.
        Nrs   r   s    r^   r   zMySQLConnectionAbstract.close  r  r  zCallable[[], Any]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 dictionary or
        named 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
                              CursorBase.
            ValueError: When cursor is not available.
        Nrs   )rg   r   r   preparedcursor_class
dictionarynamed_tuples          r^   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.
        Nrs   )rg   r  columnsr   s       r^   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.
        Nrs   )rg   countr  r  r   	prep_stmts         r^   r  z MySQLConnectionAbstract.get_rows  r  r  c                   K   yw)zCommit current transaction.Nrs   r   s    r^   commitzMySQLConnectionAbstract.commit-  r  r  c                   K   yw)zRollback current transaction.Nrs   r   s    r^   rollbackz MySQLConnectionAbstract.rollback1  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.
        Nrs   r   s    r^   cmd_reset_connectionz,MySQLConnectionAbstract.cmd_reset_connection5  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.
        Nrs   )rg   r~   s     r^   cmd_init_dbz#MySQLConnectionAbstract.cmd_init_db=  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.
        Nrs   )rg   r  r   r   raw_as_strings        r^   rf  z!MySQLConnectionAbstract.cmd_queryE  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
        Nrs   )rg   
statementss     r^   cmd_query_iterz&MySQLConnectionAbstract.cmd_query_iterY  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.
        Nrs   )rg   statement_idrowss      r^   cmd_stmt_fetchz&MySQLConnectionAbstract.cmd_stmt_fetchk  r  r  c                   K   yw)zPrepare a MySQL statement.

        This method will send the PREPARE command to MySQL together with the given
        statement.
        Nrs   )rg   	statements     r^   cmd_stmt_preparez(MySQLConnectionAbstract.cmd_stmt_prepares  r  r  c                   K   yw)z#Execute a prepared MySQL statement.Nrs   )rg   r  datarI  r  s        r^   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.
        Nrs   rg   r  s     r^   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.
        Nrs   r  s     r^   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.

        Usage example:
           RefreshOption = mysql.connector.RefreshOption
           refresh = RefreshOption.LOG | RefreshOption.INFO
           cnx.cmd_refresh(refresh)
        Nrs   )rg   optionss     r^   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.
        Nrs   )rg   r  param_idr  s       r^   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.
        Nrs   r   s    r^   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.
        Nrs   )rg   shutdown_types     r^   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.
        Nrs   r   s    r^   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.
        Nrs   )rg   	mysql_pids     r^   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.
        Nrs   r   s    r^   	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.
        Nrs   r   s    r^   cmd_pingz MySQLConnectionAbstract.cmd_ping  r  r  )Rrz   Optional[str]r{   rL   r|   rL   r}   rJ   r~   r4  r   rL   r   rL   r   rL   rQ   rL   r   rL   rS   r4  r   Optional[int]r   rW   r   rW   r   rW   r   r4  r   zDict[str, str]r   r4  r   r4  r   rW   r   rW   r   rW   r   rW   r   r4  r   r4  r   +Optional[Union[str, Callable[[str], None]]]r   r6  rv   rW   rw   r4  r   zOptional[MySQLConverter]r   rW   r   rJ   r   r4  r   r4  r   r4  r   r4  r   Optional[bool]r   r7  ry   r7  r   zOptional[List[str]]r   z#Optional[asyncio.AbstractEventLoop])rl   r   NNNr   zOptional[Type[BaseException]]r   zOptional[BaseException]r   zOptional[TracebackType]rl   rm   rk   )r   )rJ  rL   rK  zUnion[str, Callable]rL  rJ   rl   rm   rl   r5  )rl   rL   rl   rJ   rl   r4  )r+  rL   rl   rm   rl   rW   )r+  rW   rl   rm   )rl   zasyncio.AbstractEventLoop)rl   z$List[Tuple[str, BinaryProtocolType]])r+  zUnion[str, Sequence[int]]rl   rm   )r  rL   rl   r9   NN)rQ   zOptional[Union[int, str]]r   r4  rl   rm   )r  rJ   rl   rW   )r  rL   rl   rm   )rl   zOptional[Tuple[int, ...]])Fr@   r   )r  rW   r  rJ   r  rJ   rl   rW   )r  zUnion[int, Sequence[int]]rl   rJ   )r  zOptional[Type[MySQLConverter]]rl   rm   )r+  zTuple[str, BinaryProtocolType]rl   rm   r	  rL   rl   r3   )r  r<   rl   Optional[RowType])r  r   rl   rm   )r@   r   )r  rJ   r  rJ   rl   rm   )rl   r   )NNNNNN)r   r7  r   r7  r  r7  r  z#Optional[Type[MySQLCursorAbstract]]r  r7  r  r7  rl   r   )FNN)r  rW   r  Optional[List[DescriptionType]]r   r7  rl   z1Tuple[Optional[RowType], Optional[EofPacketType]])NFNNN)r  r5  r  rW   r  rA  r   r7  r  r   rl   z-Tuple[List[RowType], Optional[EofPacketType]])r~   rL   rl   r7   )FFF)
r  r<   r   rW   r   rW   r  rW   rl   r9   )r  r<   rl   z!Generator[ResultType, None, None]r@   )r  rJ   r  rJ   rl   rm   )r  rT   rl   z/Mapping[str, Union[int, List[DescriptionType]]])rs   rs   r   )
r  zUnion[int, CMySQLPrepStmt]r  zSequence[BinaryProtocolType]rI  r   r  rJ   rl   z&Optional[Union[Dict[str, Any], Tuple]])r  rJ   rl   rm   )r!  rJ   rl   r7   )r  rJ   r$  rJ   r  r   rl   rJ   )rl   rT   r[   )r)  r5  rl   rm   )rl   r;   )r.  rJ   rl   r7   )rl   r5   )rl   r7   )^rn   ro   rp   rq   r&   r   r   r   r   r  r  staticmethodr  propertyr   rO  rz   rT  rV  r   r~   setterrc  rg  ri  rl  r   rp  rr  rt  r   r{  r  r   r  r  r   r  r  r   r   r  rQ   r  r  r  r  r  r  r  r  r  r  r   r  r  r   r  r  r  r  r  r   ra  r  r  r   r  r  r   r  rr   r  r   r  r  r  r	  r  rf  r  r  r  r  r  r  r"  r%  r'  r*  r,  r/  r1  r3  rs   rj   r^   r   r      s	   1
 #"&%)&* % #'%'"&&*""',0/3EIIM#89M#N4I(5
 59',"78I"J%) $"&!%*/.3'<^'L,.48[r, r, 	r,
 r, r,  r, r, r, r, r, r, #r, $r, r,  !r," #r,$ !%r,& #'r,(  )r,* $+r,, -r,.  /r,0 1r,2 3r,4 *5r,6  -7r,8 C9r,: G;r,< !=r,> %2?r,D 2Er,F !%Gr,H  Ir,J #Kr,L Mr,N  Or,P Qr,R (Sr,T ,Ur,V %Wr,X *Yr,Z 2[r,h 37-1-1	/ + +	
 
PTdO
bPRd JK  $8 DG 	   D #  #       ! ! 
 
 __
 

- % % &  &
 $ $   P P / / & & 
 
 
 

! 
 
 
 

 
 
 
 __
 
$$ " " # # ' ' ' '( # # $ $ ? ? " "  5 5  :" UYA;0A;DQA;	A;F/0)
     GH14AD	 $"2$617"
+"% + +!+F	"   %*J!) $("#'<@%)&*   !	
 : # $ 
 4  37"	 1 	
 
;    $37"  1	
   
7  * * , ,      #  	
  
 &$	*$   	8   .0!202 +2 	2
 2 
02 2     
 
+.6>	"            rj   r   c                     e Zd ZdZddZd dZ	 	 	 d!	 	 	 	 	 	 	 d"dZd#dZd$dZe	d%d       Z
e	d&d	       Ze	d'd
       Ze	d(d       Zd(dZe	d&d       Ze	d)d       Ze	d*d       Ze	d+d       Zed,d       Ze	 	 d-	 	 	 	 	 	 	 d.d       Z	 d/	 	 	 	 	 d0dZe	 	 	 	 	 	 d1d       Zed2d       Zed3d       Zed4d5d       Zed+d       Zd'dZd6d7dZd8dZd9dZd:dZ d;dZ!y)<r   z#Defines the MySQL cursor interface.c                   || _         |j                  | _        d | _        d | _        d | _        d| _        d | _        g | _        g | _	        d| _
        d| _        d| _        d| _        d| _        | j                   j                  |        y )Nr   Fr#  r>  r@   )_connectionr   r   _description_last_insert_id	_warnings_warning_count	_executed_executed_list_stored_results_binaryr   	_rowcount_nextrow	arraysizer  )rg   
connections     r^   r   zMySQLCursorAbstract.__init__  s    4>0:
=A.26:#$/302*,"	 L
  ##D)rj   c                   K   | S wr[   rs   r   s    r^   r   zMySQLCursorAbstract.__aenter__  s        Nc                @   K   | j                          d {    y 7 wr[   r   r   s       r^   r   zMySQLCursorAbstract.__aexit__  r   r   c                   K   | S w)zIterate over result set.

        Iteration over the result set which calls self.fetchone()
        and returns the next row.
        rs   r   s    r^   	__aiter__zMySQLCursorAbstract.__aiter__	  s      rV  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  r/   StopAsyncIteration)rg   rows     r^   __next__zMySQLCursorAbstract.__next__  sD     
	/'C $$
 ( 	/$$.	/s    <( &( 
<( 9<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.
        )rI  r   s    r^   descriptionzMySQLCursorAbstract.description  s    $    rj   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.
        )rQ  r   s    r^   rowcountzMySQLCursorAbstract.rowcount2  s     ~~rj   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 or None when there is no such value available.
        rJ  r   s    r^   	lastrowidzMySQLCursorAbstract.lastrowid?  s     ###rj   c                    | j                   S )zReturn warnings.rK  r   s    r^   r  zMySQLCursorAbstract.warningsH  s     ~~rj   c                    | j                   S )zReturns Warnings.rf  r   s    r^   fetchwarningsz!MySQLCursorAbstract.fetchwarningsM  s    ~~rj   c                    | j                   S )zReturn the number of warnings.

        This property returns the number of warnings generated by the previously
        executed operation.
        )rL  r   s    r^   warning_countz!MySQLCursorAbstract.warning_countQ  r  rj   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   Nrs   )r\   ds     r^   r_   z3MySQLCursorAbstract.column_names.<locals>.<genexpr>b  s     4aQqT4s   )r_  re   r   s    r^   column_namesz MySQLCursorAbstract.column_namesZ  s+     7N44#3#3444rj   c                    | j                   y	 | j                   j                         j                         S # t        t        f$ r | j                   j                         cY S w xY w)zReturns the executed statement

        This property returns the executed statement.
        When multiple statements were executed, the current statement in the iterator
        will be returned.
        N)rM  r   decoder   UnicodeDecodeErrorr   s    r^   r  zMySQLCursorAbstract.statementd  sZ     >>!	*>>'')0022 23 	*>>''))	*s   '7 )A#"A#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.
        )rW   rI  r   s    r^   	with_rowszMySQLCursorAbstract.with_rowss  s     D%%&&rj   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.
        Nrs   r   s    r^   stored_resultsz"MySQLCursorAbstract.stored_results|  rP  rj   c                   K   yw)au  Executes the given operation.

        Executes the given operation substituting any markers with the given
        parameters.

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

        If the `multi`` parameter is used a `ProgrammingError` is raised. The method for
        executing multiple statements is `executemulti()`.

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

        Raises:
            ProgramingError: If multi parameter is used.
        Nrs   )rg   	operationparamsmultis       r^   r  zMySQLCursorAbstract.execute  r  r  c                   K   yw)zExecute multiple statements.

        Executes the given operation substituting any markers with the given
        parameters.
        Nrs   )rg   rw  rx  s      r^   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().
        Nrs   )rg   rw  
seq_paramss      r^   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.
        Nrs   r   s    r^   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.
        Nrs   r   s    r^   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.
        Nrs   )rg   sizes     r^   	fetchmanyzMySQLCursorAbstract.fetchmany  r  r  c                   K   yw)zClose the cursor.Nrs   r   s    r^   r   zMySQLCursorAbstract.close  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.
        rc  r   s    r^   getlastrowidz MySQLCursorAbstract.getlastrowid  s     ###rj   c                   K   yw)zReset the cursor to default.Nrs   )rg   frees     r^   resetzMySQLCursorAbstract.reset  r  r  c                    t        | d      r| j                  j                  S t        | d      r| j                  j                  S y)zGets a list of query attributes from the connector's side.

        Returns:
            List of existing query attributes.
        _cnxrH  N)hasattrr  rr  rH  r   s    r^   get_attributesz"MySQLCursorAbstract.get_attributes  s=     4 99(((4'##///rj   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
  rL   r2   r    rH  r  )rg   r	  r+  s      r^   add_attributez!MySQLCursorAbstract.add_attribute  s]     $$"#KLLZ~%F"% DE  	++T5M:rj   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
  rL   r2   rH  r  r  s     r^   remove_attributez$MySQLCursorAbstract.remove_attribute  s1     $$"#KLL22488rj   c                8    | j                   j                          y)z<Clears the list of query attributes on the connector's side.N)rH  r  r   s    r^   clear_attributesz$MySQLCursorAbstract.clear_attributes  s    **,rj   )rT  r   )rl   r   r8  r9  )rl   zIterator[RowType])rl   r:   )rl   rA  r;  r:  )rl   zOptional[List[WarningType]])rl   zTuple[str, ...]r<  r=  )rl   zIterator[MySQLCursorAbstract])rs   F)rw  r<   rx  $Union[Sequence[Any], Dict[str, Any]]ry  rW   rl   rm   )rs   )rw  r<   rx  r  rl   z)AsyncGenerator[MySQLCursorAbstract, None])rw  rL   r}  zSequence[ParamsSequenceType]rl   rm   )rl   r@  )rl   zList[RowType]rB  )r  rJ   rl   zList[Sequence[Any]])T)r  rW   rl   r   )rl   z.Optional[List[Tuple[str, BinaryProtocolType]]])r	  rL   r+  r3   rl   rm   r?  rk   )"rn   ro   rp   rq   r   r   r   rY  r]  rD  r_  ra  rd  r  rh  rj  rn  r  rs  r   ru  r  r{  r~  r  r  r  r   r  r  r  r  r  r  rs   rj   r^   r   r     s   -*(
 37-1-1	/ + +	
 
 ! !& 
 
 $ $   # # 5 5 * * ' '    8:	 5 	
 
 6 8:		 5	 
3		  1 
	      	 	    $+
;,9-rj   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)rn   ro   rp   rq   rs   rj   r^   r  r    s    rj   r  )]rq   
__future__r   __all__r   r  rb   r  r   abcr   r   dataclassesr	   r
   inspectr   typesr   typingr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   	abstractsr   r   r    r!   r"   r#   r$   	constantsr%   r&   r'   r(   r)   r*   r+   
conversionr,   r-   errorsr.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   utilsr>   r?   authenticationrA   rC   rB   rK   rD   networkrE   rF   r	  ro  WeakValueDictionaryrH   rr   r   r   r   r  rs   rj   r^   <module>r     s  @ 2 "
J  	 	   # (      &     <     2 . ' #8 77g;V7;V;V;X 8 X % % %DJc JZ*u-# u-p		^ 	rj   