
    *h                    V   S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
Jr  SSKJr  SSKJrJrJrJrJrJrJrJrJrJrJrJr  SSKJr  SS	KJrJr  SS
K J!r!  SSK"J#r#  SSK$J%r%J&r&  SSK'J(r(J)r)J*r*J+r+J,r,J-r-  SSK.J/r/  SSK0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8  SSK9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrCJDrD  SSKEJErE  SSKFJGrGJHrHJIrI  SSKJJKrK  SSKLJMrM  SSKNJOrOJPrPJQrQJRrRJSrS  SSKTJUrUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\J]r]  SSK^J_r_J`r`JaraJbrbJcrcJdrd  \(       a  SSK"Jere  \K(       a  SSKfJgrgJhrh   " S S\#5      rig)z.Implementing communication with MySQL servers.    )annotationsN)Decimal)IOBase)TYPE_CHECKINGAnyBinaryIODict	GeneratorListMappingOptionalSequenceTupleTypeUnion   )version)cmd_refresh_verify_optionshandle_read_write_timeout)get_local_infile_filenames)MySQLConnectionAbstract)MySQLAuthenticatorget_auth_plugin)
ClientFlag	FieldTypeRefreshOption	ServerCmd
ServerFlagflag_is_set)MySQLConverter)MySQLCursorMySQLCursorBufferedMySQLCursorBufferedDictMySQLCursorBufferedRawMySQLCursorDictMySQLCursorPreparedMySQLCursorPreparedDictMySQLCursorRaw)ConnectionTimeoutErrorDatabaseErrorErrorInterfaceErrorInternalErrorNotSupportedErrorOperationalErrorProgrammingErrorReadTimeoutErrorWriteTimeoutErrorget_exception)logger)MySQLSocketMySQLTCPSocketMySQLUnixSocket)OTEL_ENABLED)with_context_propagation)
EOF_STATUS
ERR_STATUSLOCAL_INFILE_STATUS	OK_STATUSMySQLProtocol)	BinaryProtocolTypeDescriptionTypeEofPacketTypeHandShakeTypeOkPacketType
ResultTypeRowTypeStatsPacketType
StrOrBytes)get_platform	int1store	int4storelc_intwarn_ciphersuites_deprecatedwarn_tls_version_deprecated)CMySQLPrepStmt)end_spanrecord_exception_eventc                    ^  \ rS rSrSrS9U 4S jjrS:S jrS:S jr      S;             S<S jjrS=S jr	S:S jr
S:S	 jrS:S
 jr\r\" 5              S>                 S?S jj5       r\" 5          S@         SAS jj5       rSBS jr\SCS j5       rSDS jrSES jr\" 5         SF       SGS jj5       r\" 5         SF       SHS jj5       r    SI           SJS jjr\" 5            SK             SLS jj5       rS:S jrSMS jr\\" 5          SN           SOS jj5       5       r\" 5             SPS j5       r\" 5       SQS j5       r SRS jr!SSSTS jjr"\" 5       SUS j5       r#SVS jr$SWS jr%SXS jr&\" 5                 SY                     SZS  jj5       r'\S[S! j5       r(\(RR                  S\S" j5       r(SCS# jr*S]S$ jr+\,RZ                  RR                  S^S% j5       r-  SF     S_S& jjr.S`SaS' jjr/\SbS( j5       r0       Sc               SdS) jjr1S:S* jr2S:S+ jr3SeS, jr4SfS- jr5SgS. jr6\" 5        SS     ShS/ jj5       r7 Si       SjS0 jjr8\" 5             SkS1 j5       r9\   Sl           SmS2 jj5       r:      SnS3 jr;          SoS4 jr<      SnS5 jr=SCS6 jr>S:S7 jr?S8r@U =rA$ )pMySQLConnection   zConnection to a MySQL Serverc                  > S U l         S U l        S U l        [        TU ]  5         [
        U l        [        R                  " 5       U l	        S U l
        S U l        SU l        SU l        SU l        SU l        SU l        SU l        S U l        SU l        SU l        0 U l        SU l        SU l        SU l        SU l        SU l        SU l        SU l        SU l        SU l        S U l        SU l         S U l!        S U l"        S U l#        SU l$        / U l%        SU l&        [O        5       U l(        U(       a   U RR                  " S0 UD6  g g ! [T         a    U RW                  5         S U l        e f = f)	NF z	127.0.0.1i  r   Tr    ),	_protocol_socket
_handshakesuper__init__r    _converter_classr   get_default_client_flags	_sql_mode
_time_zone_autocommit_user	_password	_database_host_port_unix_socket_client_host_client_port_ssl_force_ipv6_use_unicode_get_warnings_raise_on_warnings	_buffered_unread_result_have_next_result_raw_in_transaction_prepared_statements_ssl_active_auth_plugin_krb_service_principal_pool_config_version_query_attrs_supported_columns_desc_mfa_nfactorr   _authenticatorconnect	Exceptionclose)selfkwargs	__class__s     R/var/www/auris/envauris/lib/python3.13/site-packages/mysql/connector/connection.pyr[   MySQLConnection.__init__   se   26.2376D","8"8":(,)-!&
  %

+/!#!"FH	!&"&#((-$$)',	%*)-!!&+/59#)-!+0#46!"2D2F&v&   

#	s   ,E   #E#c                   [        5       n[        R                  R                  S5      nUS   S:X  a  SnOSn[	        [
        R                  " 5       5      US   [        R                  " 5       SUSR                  [        R                  SS	  Vs/ s H  n[	        U5      PM     sn5      US
   S.nU R                  R                  U5        gs  snf )z&Add the default connection attributes. r   GPLv2zGPL-2.0
Commercialarchzmysql-connector-python.   r   )_pid	_platform_source_host_client_name_client_license_client_version_osN)rH   r   LICENSEsplitstrosgetpidsocketgethostnamejoinVERSION_conn_attrsupdate)r   platformlicense_chunksclient_licensexdefault_conn_attrss         r   _add_default_conn_attrs'MySQLConnection._add_default_conn_attrs   s    > ..s3!'&N)N		$!&)"..04-"xx19M(N9MAQ9M(NOI&
 	!35	 )Os   Cc                   [        U R                  R                  5       5      nUS   [        :X  a  [	        U5      eSU l        U R                  R                  U5      nUS   nU R                  [        U[        [         [        45      (       a  UOS5      U l        U R                  R                  U R                  5        US   [        R                   -  (       d  U R"                  (       d6  U R$                  S:X  a  ['        S5      eU R$                  S:X  a  ['        S	5      eU R(                  R+                  S
5      (       a
  ['        SSS9eU =R,                  [        R                   ) -  sl        O4U R.                  (       d#  U =R,                  [        R                   -  sl        US   [        R0                  -  (       a  [        R0                  /U l        US   [        R4                  -  (       a  SU l        [        R4                  /U l        US   [        R8                  -  (       a  [        R8                  /U l        X l        g)z'Get the handshake from the MySQL server   Nserver_version_originalUnknowncapabilitiesmysql_clear_passwordzEClear password authentication is not supported over insecure channels$authentication_openid_connect_clientzEOpenID Connect authentication is not supported over insecure channelsverify_certz1SSL is required but the server doesn't support iti  )errnoT)bytesrX   recvr;   r3   rY   rW   parse_handshake_check_server_version
isinstancer   	bytearray_server_version_character_setset_mysql_versionr   SSL	is_securerv   r,   rj   getr^   _ssl_disabledPLUGIN_AUTHclient_flagsCLIENT_QUERY_ATTRIBUTESry   MULTI_FACTOR_AUTHENTICATION)r   packet	handshakeserver_versions       r   _do_handshakeMySQLConnection._do_handshake   s   t||((*+!9
"''NN226:	"#<=#99.3y*ABB  

 	--d.B.BC(:>>9>>$$(>>(,  $$(NN(,  yy}}]++$G  :>>/1##*..0^$z'='==!+!7!7 8D^$z'I'II*.D'!+!C!C DD^$z'M'MM!+!G!G HD#    c                \   U R                   R                  S5      (       d4  U R                   R                  S5      (       aR  [        R                  S:X  a>  U(       d7  [        R
                  " 5       n[        R                  " SUU R                   5        U R                  (       a  X R                  :w  a  U R                  nSU l	        U R                  (       dZ  U[        R                  -  (       aB  U R                  R                  U R                  U R                   UU R"                  US9  SU l	        U R                  R%                  U R&                  U R(                  U R*                  U R,                  U R.                  S.S	9  U R                  R1                  U R                  U R2                  UUU R4                  U R6                  UU R"                  UU R                   U R8                  US
9nU R;                  U5        U[        R<                  -  (       d  U(       a  U R?                  U5        g)a5  Authenticate with the MySQL server

Authentication happens in two parts. We first send a response to the
handshake. The MySQL server will then send either an AuthSwitchRequest
or an error packet.

Raises NotSupportedError when we get the old, insecure password
reply back. Raises any error coming from MySQL.
authentication_ociauthentication_kerberosntz4MySQL user is empty, OS user: %s will be used for %sF)charsetr   T)krb_service_principaloci_config_fileoci_config_profilewebauthn_callbackopenid_token_fileconfig)sockr   username	password1	password2	password3databaser   r   auth_pluginauth_plugin_class
conn_attrs) rv   
startswithr   namegetpassgetuserr4   debug
_password1ru   r   r   r   r|   	setup_sslrX   server_host_charset_idupdate_plugin_configrw   _oci_config_file_oci_config_profile_webauthn_callback_openid_token_fileauthenticaterY   
_password2
_password3_auth_plugin_class
_handle_okCONNECT_WITH_DBcmd_init_db)r   r   passwordr   r   ssl_optionsr   ok_pkts           r   _do_authMySQLConnection._do_auth  s   & (()=>>!!,,-FGGGGtO(HLLF!! ??x??:H !!|jnn'D))  (() *   $D 	00)-)D)D#'#8#8&*&>&>%)%<%<%)%<%< 	1 	
 $$11oooooo$$%))"55! 2 
 	z999xX&r   c                   SnU R                   (       a(  [        R                  S:X  a  [        U R                  S9nO)[        U R                  U R                  U R                  S9nUR                  U R                  5        U$ )zGet connection based on configuration

This method will return the appropriated connection object using
the connection parameters.

Returns subclass of MySQLBaseSocket.
Nposix)unix_socket)hostport
force_ipv6)rg   r   r   r7   r   r6   r   server_portrk   set_connection_timeout_connection_timeout)r   conns     r   _get_connectionMySQLConnection._get_connectionU  sm     G!3"t/?/?@D!%%%%++D 	##D$<$<=r   c                b   U R                   nU R                  nS=U l         U l        U R                  S:X  aF  U R                  (       d5  [	        U R                  U R
                  5      nUR                  5       U l        [        5       U l        U R                  5       U l
         U R                  R                  5         U R                  5         U R                  U R                  U R                  U R                  U R                   U R"                  U R$                  5        U R&                  U l        U R                   [*        R,                  -  (       a  U R                  R/                  5         U R                  R1                  S5         Xl         X l        U RB                  (       d  [E        U R                  RF                  S5      (       am  [I        U R                  RF                  RJ                  5      (       a>  U R                  RF                  RK                  5       u  pVn[M        U5        [O        XV5        gggg! [2         a[  nU R                  R5                  5         [7        U[8        [:        45      (       a  [=        UR>                  UR@                  S9UeUeSnAff = f! Xl         X l        f = f)z~Open the connection to the MySQL server

This method sets up and opens the connection to the MySQL server.

Raises on errors.
Nauthentication_kerberos_client)r   msgcipher)(read_timeoutwrite_timeoutrv   rb   r   r   get_user_from_credentialsr>   rW   r   rX   open_connectionr   r   rc   rd   r^   rj   r   r\   converter_classr   COMPRESSswitch_to_compressed_moder   r~   close_connectionr   r1   r2   r)   r   r  r   hasattrr   callabler  rM   rL   )r   stored_read_timeoutstored_write_timeoutclserrr  tls_version_s           r   _open_connection MySQLConnection._open_connectionj  s    #//#11155D. @@!$"3"3T5L5LMC668DJ&++-#	6LL((*   MM

""		   $(#8#8D !!J$7$77668LL//5 !4!5 ""))844**1122 &*\\%6%6%=%=%?"F'4(= 3 5 #!  	LL))+# 02CDEE,))  I	 !4!5s&   "C$H8 8
JAJJJ   J.c                    U R                   (       d  g U R                   R                  5         g! [        [        4 a     gf = f)a@  Shut 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.
N)rX   shutdownAttributeErrorr+   r   s    r   r  MySQLConnection.shutdown  s:     ||	LL!!#& 		s   / AAc                h   U R                   (       aK  U R                   R                  5       (       a,  [        U R                   [        R                  " 5       S   5        U R
                  (       d  g  U R                  5          U R
                  R                  5          [        (       a  [        U R                   5        S U l        g ! [        [        4 a     NVf = f! [         a'  n[        (       a  [        U R                   U5        e S nAff = f! [        (       a  [        U R                   5        f f = f)Nr   )_spanis_recordingrP   sysexc_inforX   cmd_quitr  r+   r  r~   r8   rO   rY   )r   r  s     r   r   MySQLConnection.close  s    ::$**1133"4::s||~a/@A||	MMO	%LL))+ |$ & 		
  	|&tzz37	
 |$ s6   0C C CC
D$"DDD #D1c	                t   U R                  5          U R                  R                  U R                  R	                  X=(       d    U5      UUU=(       d    U R
                  5        U(       a.  U R                  R                  U=(       d    U R                  5      $ S$ ! [         a  n	[        S5      U	eSn	A	ff = f)a  Send a command to the MySQL server

This method sends a command with an optional argument.
If packet is not None, it will be sent and the argument will be
ignored.

The packet_number is optional and should usually not be used.

Some commands might not result in the MySQL server returning
a response. If a command does not return anything, you should
set expect_response to False. The _send_cmd method will then
return None instead of a MySQL packet.

Returns a MySQL packet or None.
NMySQL Connection not available)
handle_unread_resultrX   sendrW   make_command_write_timeoutr   _read_timeoutr  r/   )
r   commandargumentpacket_numberr   expect_responsecompressed_packet_numberr  r  r  s
             r   	_send_cmdMySQLConnection._send_cmd  s    6 	!!#	NLL++G5GxH(4!4!4	 # !!,"D$2D2DE 
  	N"#CD#M	Ns   BB B 
B7&B22B7c                   U R                  5         [        US5      (       d  [        S5      eSn UR                  US-
  5      nU(       aI  U R                  R                  Xd=(       d    U R                  S9  UR                  US-
  5      nU(       a  MI  U(       a.   U R                  R                  SU=(       d    U R                  S9  U R                  R                  U=(       d    U R                  5      $ ! [         a  n[        S5      UeSnAff = f! [         a  nUeSnAf[         a  n[        S5      UeSnAff = f)	a  Send data to the MySQL server

This method accepts a file-like object and sends its data
as is to the MySQL server. If the send_empty_packet is
True, it will send an extra empty package (for example
when using LOAD LOCAL DATA INFILE).

Returns a MySQL packet.
readzexpecting a file-like object      r  r#  Nr   )r$  r  
ValueErrorr1  rX   r%  r'  r  r/   r2   r   r(  )r   	data_filesend_empty_packetr  r  
chunk_sizebufr  s           r   
_send_dataMySQLConnection._send_data	  s.   " 	!!#y&));<<
	N..b1C!!'K8K8K "   nnZ"_5	 # R!!}'K8K8K "  ||  !C1C1CDD  	N"#CD#M	N % 	! R&'GHcQRs<   A"C7 -D 7
DDD
D?D!!D?.D::D?c                    [        [        R                  U5      U l        [        [        R                  U5      U l        g)zHandle the server flags found in MySQL packets

This method handles the server flags send by MySQL OK and EOF
packets. It, for example, checks whether there exists more result
sets or whether there is an ongoing transaction.
N)r   r   MORE_RESULTS_EXISTSrq   STATUS_IN_TRANSrs   )r   flagss     r   _handle_server_status%MySQLConnection._handle_server_status6  s.     "-Z-K-KU!S*:+E+EuMr   c                    U R                   $ )z'MySQL session has started a transaction)rs   r  s    r   in_transactionMySQLConnection.in_transaction@  s     ###r   c                    US   [         :X  a1  U R                  R                  U5      nU R                  US   5        U$ US   [        :X  a  [        U5      e[        S5      e)zHandle a MySQL OK packet

This method handles a MySQL OK packet. When the packet is found to
be an Error packet, an error will be raised. If the packet is neither
an OK or an Error packet, InterfaceError will be raised.

Returns a dict()
r   status_flagzExpected OK packet)r=   rW   parse_okr@  r;   r3   r,   )r   r   r   s      r   r   MySQLConnection._handle_okE  s_     !9	!^^,,V4F&&vm'<=M!9
"''122r   c                    US   [         :X  a1  U R                  R                  U5      nU R                  US   5        U$ US   [        :X  a  [        U5      e[        S5      e)zHandle a MySQL EOF packet

This method handles a MySQL EOF packet. When the packet is found to
be an Error packet, an error will be raised. If the packet is neither
and OK or an Error packet, InterfaceError will be raised.

Returns a dict()
r   rF  zExpected EOF packet)r:   rW   	parse_eofr@  r;   r3   r,   )r   r   eofs      r   _handle_eofMySQLConnection._handle_eofV  s_     !9
"..**62C&&s='9:J!9
"''233r   c                   U R                   c7  [        U R                  5      U l         U R                   (       d  [        S5      eOU R                   (       d  [        S5      e[        R
                  R                  U5      n[        R
                  R                  U R                   R                  5       5      n[        R
                  R                  U5      (       d  [        SU S35      e[        R
                  R                  U5      (       d  [        SU S35      e [        R
                  R                  XE5      (       d  [        SU SU S	35      e [        R
                  R                  U5      (       a  [        S
5      eU R                  (       d  U R                  (       d  [        S5      eU R                  (       d~  U R                  (       am  [        R
                  R                  U R                  5      nSn [        R
                  R!                  Xt/5      nX:w  a  Sn	[        U	R%                  XG5      5      e [)        US5      n
U R+                  U R-                  U
SX#5      5       U
R/                  5         $ ! [         a  n[        UeSnAff = f! ["         a,  nSn	[        U	R%                  ['        U5      XG5      5      UeSnAff = f! [0        [2        4 a     $ f = f! [0         a^     U R4                  R7                  SU=(       d    U R8                  S9  O! [:         a  n[        S5      UeSnAff = f[        SU S35      Sef = f!  W
R/                  5         f ! [0        [2        4 a     f f = f= f)z'Handle a LOAD DATA INFILE LOCAL requestNzxNo `LOCAL INFILE` statements found in the client's request. Check your request includes valid `LOCAL INFILE` statements.zGot more `LOCAL INFILE` responses than number of `LOCAL INFILE` statements specified in the client's request. Please, report this issue to the development team.zLocation specified by filename z& from client's request does not exist.z' from server's response does not exist.z	Filename z8 from the server's response is not the same as filename z from the client's request.z#Use of symbolic link is not allowedKLOAD DATA LOCAL INFILE file request rejected due to restrictions on access.zL{} while loading file `{}` and path `{}` given in allow_local_infile_in_pathzEThe file `{}` is not found in the given allow_local_infile_in_path {}rbTr   r4  r#  zFile 'z' could not be read)_local_infile_filenamesr   _queryr,   r   pathabspathpopleftexistssamefileOSErrorislinkr/   _allow_local_infile_allow_local_infile_in_pathr*   
commonpathr5  formatr   openr   r:  r   IOError	NameErrorrX   r%  r'  r  )r   filenamer  r  	file_namefile_name_from_requestr  infile_pathc_patherr_msgr6  s              r   _handle_load_data_infile(MySQLConnection._handle_load_data_infileg  sM    ''/+Edkk+RD(//$S  0
 -- 1  GGOOH-	!#1M1M1U1U1W!X ww~~455 12H1I J8 8  ww~~i(( 1) =+ + 	*77##IFF$	{ +##9": ;((  G 77>>)$$"#HII''0P0P*  ''D,L,L''//$*J*JKKF	++[,DE $4  $GNN9$JKK	Y-I??	4M!a  	* c)	*   5  %NN3s8YDB Y'   	TR!!}'K8K8K "  " R&'GHcQR 6)4G!HItS	T!Y' s   6J  ? J -K( /K 
J
JJ
K#'K

KK%$K%(
M3-L! M!
L<+L77L<<MM M<M&%M<&M96M<8M99M<c                t   U(       a  [        U5      S:  a  [        S5      eUS   [        :X  a  U R                  U5      $ US   [        :X  a%  USS R                  5       nU R                  XBU5      $ US   [        :X  a  U R                  U5      $ US   [        :X  a  [        U5      eU R                  R                  U5      nU(       a  [        U[        5      (       d  [        S5      eS/U-  U l        [!        SU5       Hb  nU R                  R#                  U R$                  R'                  U=(       d    U R(                  5      U R*                  5      U R                  U'   Md     U R                  U R$                  R'                  U=(       d    U R(                  5      5      nSU l        U R                  US.$ )	aN  Handle a MySQL Result

This method handles a MySQL result, for example, after sending the
query command. OK and EOF packets will be handled and returned. If
the packet is an Error packet, an Error-exception will be
raised.

The dictionary returned of:
- columns: column information
- eof: the EOF-packet information

Returns a dict()
r   Empty response   NzIllegal result setr   T)columnsrK  )lenr,   r=   r   r<   decoderg  r:   rL  r;   r3   rW   parse_column_countr   intrz   rangeparse_columnrX   r   r(  python_charsetunread_result)r   r   r  r  ra  column_countirK  s           r   _handle_resultMySQLConnection._handle_result  s   ( Vq !122!9	!??6**!9++abz((*H00WW!9
"##F++!9
"'' ~~88@:lC#@#@ !566 
 q,'A$(NN$?$?!!,"D$2D2DE##%Dq! ( t||001SASASTU!--c::r   c                t    UR                  SS5      nU R                  SUUUUS9u  pxU(       a  US   U4$ SU4$ )a$  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.

Returns a tuple.
r  Nr   )countbinaryrl  rawr  r   )r   get_rows)	r   r{  rl  r|  	prep_stmtr   r  rowsrK  s	            r   get_rowMySQLConnection.get_row  sU    " zz.$7mm% $ 
 GS>!c{r   c                6   Uc  U R                   nU R                  (       d  [        S5      e/ S4n UR                  SS5      nU(       aQ  U R                  n	U	S:X  a  Sn	U R
                  R                  U R                  UUU	U=(       d    U R                  5      nOFU R
                  R                  U R                  U R                  UU=(       d    U R                  5      n Uu  p{U(       dc  U(       d\  U R                  bO  U(       aH  [        U S5      (       a7  U R                  R                  nU Vs/ s H  o" XR                  5      PM     nnUb&  U R!                  SU;   a  US   OUS	   5        SU l        X{4$ ! [         a  n
SU l        U
eSn
A
ff = fs  snf )
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.

Returns a tuple()
NzNo result set availabler  utf8mb4utf8F	converterrF  server_status)rr   rt  r-   r   r   rW   read_binary_resultrX   r(  read_text_resultr   r+   rz   r  r  row_to_pythonr@  )r   rz  r{  rl  r|  r~  r   r  r  r   r  eof_pr  rows                 r   r}  MySQLConnection.get_rows  s   $ ;))C!! 9::=?J	!::nd;L,,i'$G~~88LL 6D$6$6 ~~66LL(( 6D$6$6	 3"".k** NN88MFJKdsM#'9'9:dDK&& E) m$?+
 "'D{-  	!&DI	 Ls%   A)E; AE; 2F;
F	FFc                H    U R                   (       a  U R                  5         gg)zConsume resultsN)rt  r}  r  s    r   consume_resultsMySQLConnection.consume_results_  s    MMO r   c                ~    U R                  U R                  [        R                  UR	                  S5      5      5      $ )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
information.

Returns a dict()
utf-8)r   r.  r   INIT_DBencode)r   r   s     r   r   MySQLConnection.cmd_init_dbd  s2     NN9,,hoog.FG
 	
r   c                R   [        U[        5      (       d1  [        U[        5      (       a  UR                  S5      n[        U5      nXl        S U l        U R                  S:w  a  U R                  OSn[        5       nU R                  (       d*  U R                  (       a  [        R                  " S[        S9  U R                  [        R                  -  (       Ga  / n/ n	/ n
S/[        U R                  5      S-   S-  -  n[!        U R                  R#                  5       5       GHW  u  pUS	   nSnUcK  XS-  ==   S	US-  -  -  ss'   U	R%                  ['        [(        R*                  5      ['        U5      -   5        M[  [        U[,        5      (       a2  U R.                  R1                  U5      u  nnnU
R%                  U5        GOU[        U[        5      (       aI  UR                  U5      nU
R%                  [3        [        U5      5      U-   5        [(        R4                  nGO[        U[6        5      (       a8  U
R%                  [3        [        U5      5      U-   5        [(        R4                  nGO[        U[8        5      (       ah  U
R%                  [3        [        [        U5      R                  U5      5      5      [        U5      R                  U5      -   5        [(        R:                  nGO-[        U[<        5      (       a7  U
R%                  [>        R@                  " S
U5      5        [(        RB                  nO[        U[D        RD                  [D        RF                  45      (       a0  U R.                  RI                  U5      u  nnU
R%                  U5        O[        U[D        RJ                  [D        RL                  45      (       a0  U R.                  RO                  U5      u  nnU
R%                  U5        O#[Q        SURR                  RT                   S35      eU	R%                  ['        U5      ['        U5      -   5        US   R                  U5      nUR%                  [3        [        U5      5      U-   5        GMZ     URW                  [3        [        U R                  5      5      5        URW                  [3        S	5      5        U
(       a  URW                  SRY                  U Vs/ s H  n[>        R@                  " SU5      PM     sn5      ['        S	5      -   5        [[        X5       H(  u  nnURW                  U5        URW                  U5        M*     U
 H  nURW                  U5        M     URW                  U5        [7        U5      n UR]                  SS 5      nUR]                  SS 5      nU R_                  U Ra                  [b        Rd                  UUUS9UU5      nU$ s  snf ! [P         a4  nURf                  S:X  a  SURh                  ;   a  Sn[k        U5      Uee S nAff = f)Nr  r  r  <This version of the server does not support Query Attributescategoryr         r   z<dz&MySQL binary protocol can not handle 'z	' objectsr   Br  r  r  r  il  zLoading local data is disabledrO  )6r   r   r   r  rR  rQ  r   ry   _query_attrswarningswarnWarningr^   r   r   rm  	enumerateitemsappendrI   r   NULLrp  rW   prepare_binary_integerrK   STRINGr   r   DECIMALfloatstructpackDOUBLEdatetimedateprepare_binary_timestamp	timedeltatimeprepare_binary_timer0   r   __name__extendr   zipr   rw  r.  r   QUERYr   r  r*   )r   queryr|  bufferedraw_as_stringr   r   r   namestypesvaluesnull_bitmappos
attr_tuplevaluer?  packed
field_typer   bit_typer  r  resultr  rf  s                             r   	cmd_queryMySQLConnection.cmd_queryq  s    %++%%%W-e$E '+$ #',,)";$,,**t/@/@MMN  
 B BBBEE"$F##d&7&7"81"<!BCK#,T->->-D-D-F#G"1=+qS1W~=+LL9>>!:Yu=M!MNeS))
 ==eD	"MM&)s++!LL1EMM&U"4u"<=!*!1!1Ju--MM&U"4u"<=!*!1!1Jw//MMs3u:#4#4W#=>?e*++G45 "+!2!2Ju--MM&++dE":;!*!1!1J(9(98=='IJJ ??F"MM&)(:(:HMM'JKK+/>>+M+Me+T(VZMM&)*!OO445Y@  Yz2Yu5EEF!!}++G4VCI.56] $Hb MM&T%6%6!789 MM&)$HH{K{fkk#s3{KLl# $'u#4KE4MM%(MM$' $5 $EMM%( $ 	ef	!::nd;L"JJ=M((OO!-"/	   	F$ E L4   	yyD %E%P1  $G,#5	s   &!W#AW( (
X&2/X!!X&c           	   +  &  #    UR                  SS5      nUR                  SS5      n[        5       n[        U[        5      (       d1  [        U[        5      (       a  UR	                  S5      n[        U5      nU R
                  [        R                  -  (       a4  UR                  [        S5      5        UR                  [        S5      5        UR                  U5        [        U5      nU R                  U R                  [        R                  UUUS9UU5      v   U R                  (       ac  U R!                  5         U R                  U R"                  R%                  U=(       d    U R&                  S9UU5      v   U R                  (       a  Mb  gg7f)	a  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 cnx.cmd_query(statement, iterate=True):
    if 'columns' in result:
        columns = result['columns']
        rows = cnx.get_rows()
    else:
        # do something useful with INSERT result

Returns a generator.
r  Nr  r  r   r   r  )r  )r   r   r   r   r  r^   r   r   r  rK   r   rw  r.  r   r  rq   r$  rX   r   r(  )r   
statementsr   r  r  r   r  s          r   cmd_query_iterMySQLConnection.cmd_query_iter  sG    , zz.$7

?D9*i00*c**'..v6
":.J
 B BBMM&)$ MM&)$j!f!!NN)+	   	
 		
 $$%%'%%!!|/Qt?Q?Q!R  $$$s   FFFc                
   U[         R                  [         R                  -  [         R                  -  [         R                  -  [         R
                  -  [         R                  -  -  (       d  [        S5      eS nU[         R                  -  (       a  U R                  S5      nU[         R                  -  (       a  U R                  S5      nU[         R                  -  (       a  U R                  S5      nU[         R                  -  (       a  U R                  S5      nU[         R
                  -  (       a  U R                  S5      nU[         R                  -  (       a#  U R                  U R                  S:  a  SOS	5      nU$ )
NzInvalid command REFRESH optionzFLUSH PRIVILEGESz
FLUSH LOGSzFLUSH TABLESz,TRUNCATE TABLE performance_schema.host_cachezFLUSH STATUS)r  r      zRESET SLAVEzRESET REPLICA)
r   GRANTLOGTABLESHOSTSTATUSREPLICAr5  r  r   )r   optionsress      r   cmd_refreshMySQLConnection.cmd_refresh(  s5    ""#   ! ""	#
 ##$
 =>>](((..!34C]&&&...C])))..0C]'''..!OPC])))..0C]***..!%!5!5
!BC 
r   c                    U R                  5         U R                  R                  [        R                  5      n U R
                  R                  USSU R                  5        U$ ! [         a  n SnAU$ SnAff = f)zClose the current connection with the server

This method sends the `QUIT` command to the MySQL server, closing the
current connection. Since there is no response from the MySQL server,
the packet that was sent is returned.

Returns a str()
r   N)	r$  rW   r&  r   QUITrX   r%  r'  r2   )r   r   r  s      r   r   MySQLConnection.cmd_quitF  sl     	!!#,,Y^^<	LLfaD,?,?@  ! 		s   (A% %
A:5A:c                &    U R                  S5        g)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.
SHUTDOWNN)r  )r   shutdown_types     r   cmd_shutdownMySQLConnection.cmd_shutdownX  s     	z"r   c                @   U R                  5         U R                  R                  [        R                  5      nU R
                  R                  USSU R                  5        U R                  R                  U R
                  R                  U R                  5      5      $ )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.

Returns a dict()
r   )r$  rW   r&  r   
STATISTICSrX   r%  r'  parse_statisticsr   r(  r   r   s     r   cmd_statisticsMySQLConnection.cmd_statistics`  sr     	!!#,,Y-A-AB&!Q(;(;<~~..t||/@/@ASAS/TUUr   c                j    [        U[        5      (       d  [        S5      eU R                  SU 35      $ )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.
zMySQL PID must be intzKILL )r   rp  r5  r  )r   	mysql_pids     r   cmd_process_kill MySQLConnection.cmd_process_killo  s3     )S))455~~i[122r   c                ^    U R                  U R                  [        R                  5      5      $ )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.

Returns a dict()
)rL  r.  r   DEBUGr  s    r   	cmd_debugMySQLConnection.cmd_debugz  s"     y ?@@r   c                ^    U R                  U R                  [        R                  5      5      $ )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.

Returns a dict()
)r   r.  r   PINGr  s    r   cmd_pingMySQLConnection.cmd_ping  s      t~~inn=>>r   c                8   Ub7  [        U[        5      (       d  [        S5      eUS:  a  [        S5      eX@l        SU l        Xl        X l        XPl        X`l        Xpl	        U R                  (       a   X R                  :w  a  U R                  U l        U R                  5         U R                  (       a  [        S5      eU(       a  Xl        U
(       a  Xl        Xl        U R                   R#                  U R                  U R                  U R                  S.S9  U R                   R%                  U R&                  U R(                  U R
                  U R                  U R                  U R                  UU R                  U R*                  U R,                  U R.                  U R0                  SU R2                  U R4                  S	9nU R*                  [6        R8                  -  (       d  U(       a  U R;                  U5        U R=                  5         U R?                  U5      $ )
zChange the current logged in user

This method allows to change the current logged in user information.
The result is a dictionary with OK packet information.

Returns a dict()
zcharset must be an integerr   z2charset should be either zero or a postive integerr   z-Change user is not supported with compression)r   r   r   r   T)r   r   r   r   r   r   r   r   r   r   r   r   is_change_user_requestr  r  ) r   rp  r5  r   r{   rb   rc   r   r   r   r$  	_compressr.   r   r   r   r|   r   r   rX   rY   r^   rv   r   r   r(  r'  r   r   r   _post_connectionr   )r   r   r   r   r   r   r   r   r   r   r   r   s               r   cmd_change_userMySQLConnection.cmd_change_user  s   . gs++ !=>>{ !UVV&
!###??x??:!__DN!!#>>#$STT$3!&7##5  	00#'#8#8&*&>&>%)%<%< 	1 	
 $$11ooZZnnoooo$$++))"55''#'++-- 2 
$ ""Z%?%??XX& v&&r   c                *    U R                  S5      S   $ )zGet the current databasezSELECT DATABASE()r   )
info_queryr  s    r   r   MySQLConnection.database  s     23A66r   c                &    U R                  U5        g)zSet the current databaseN)r   r   r  s     r   r   r    s     	r   c                F     U R                  5         g! [         a     gf = f)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.

Returns True or False.
FT)r  r+   r  s    r   is_connectedMySQLConnection.is_connected  s)    	MMO   		s    
  c                    Xl         g)zaSet the path that user can upload files.

Args:
    path (str): Path that user can upload files.
N)r[  )r   rS  s     r   set_allow_local_infile_in_path.MySQLConnection.set_allow_local_infile_in_path   s
     ,0(r   c                j    Xl         U R                  (       a  U R                  R                  U5        g g N)rl   r  set_unicoder  s     r   use_unicodeMySQLConnection.use_unicode  s&    !>>NN&&u- r   c                   U R                  5       (       d  [        S5      eU R                  5       (       d   U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  5
        U R!                  5       nU(       a0  UR#                  5        H  u  pEUR%                  SU S3U45        M     U(       a1  UR#                  5        H  u  pEUR%                  SU S3U45        M     gg! [         a    U R                  5          Nf = f)ao  Clears the current active session

This method resets the session state, if the MySQL server is 5.7.3
or later active session will be reset without re-authenticating.
For other server versions session will be reset by re-authenticating.

It is possible to provide a sequence of variables and their values to
be set after clearing the session. This is possible for both user
defined variables and session variables.
This method takes two arguments user_variables and session_variables
which are dictionaries.

Raises OperationalError if not connected, InternalError if there are
unread results and InterfaceError on errors.
zMySQL Connection not available.zSET @`z` = %szSET SESSION `N)r  r/   cmd_reset_connectionr  rb   rc   rd   r   r   r   r   r   r   r   r0   	reconnectcursorr  execute)r   user_variablessession_variablescurkeyr  s         r   reset_sessionMySQLConnection.reset_session  s   (   """#DEE((**!$$JJNNNN$$OOOOOO)),,++ kkm,224
fSE05(; 5/557
mC57%B 8  $ ! !s   A>D5 5EEc                     U R                  5         g! [         a,  nU(       a  U R                  X#S9   SnAg[        S5      UeSnAff = f)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.
)attemptsdelayz$Connection to MySQL is not availableN)r  r+   r	  r,   )r   r	  r  r  r  s        r   pingMySQLConnection.ping>  sC    	VMMO 	V>$%KLRUU		Vs    
A	AAA	c                \    U R                   (       a  U R                   R                  S5      $ g)zMySQL connection IDserver_threadidN)rY   r   r  s    r   connection_idMySQLConnection.connection_idT  s$     ????&&'899r   c                   U R                  5         U R                  5       (       d  [        S5      eUb&  [        U[        5      (       a  US:  a  [        S5      eUb&  [        U[        5      (       a  US:  a  [        S5      eUb)  [        U[        5      (       d  [        S5      eU" XU5      $ Ub  UOU R                  nUb  UOU R                  nSnUSL a  US-  nUSL a  US	-  nUSL a  US
-  nUSL a  US-  n[        [        [        [        [        [        [         ["        S.n	 X   " XU5      $ ! [$         aP    Sn
['        SSR)                  [+        S
5       Vs/ s H  oSU-  -  S:w  d  M  X   PM     Os  snf sn5      -   5      Sef = f)a  Instantiates and returns 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.

Dictionary based cursors are available with buffered
output but not raw.

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

Raises ProgrammingError when cursor_class is not a subclass of
MySQLCursor. Raises ValueError when cursor is not available.
Raises InterfaceError when read_timeout or write_timeout is not
a positive integer.

Returns a cursor-object
r#  Nr   z.Option read_timeout must be a positive integerz/Option write_timeout must be a positive integerz0Cursor class needs be to subclass of MySQLCursorTr      r   r3  )r   r   r  r   r   rk  r3     )r  r|  
dictionarypreparedz*Cursor not available with given criteria: z, )r$  r  r/   r   rp  r,   
issubclassr!   r0   ro   rr   r"   r(   r$   r%   r#   r&   r'   KeyErrorr5  r   rq  )r   r  r|  r  cursor_classr  r  r  cursor_typer  argsrv  s               r   r
  MySQLConnection.cursor[  s   > 	!!#  """#CDD#<--1A !QRR$=#..-!2C !RSS#lK88&F  !$mDD'38_c$))t1K$;1K1Kt2K "%&#'	
	&MJJ 	@D<))eAhVha:PTU:UWTWhVWX 	s   '
D2 2*FE8/E87Fc                &    U R                  S5        g)zCommit current transactionCOMMITN)_execute_queryr  s    r   commitMySQLConnection.commit  s    H%r   c                h    U R                   (       a  U R                  5         U R                  S5        g)zRollback current transactionROLLBACKN)rt  r}  r(  r  s    r   rollbackMySQLConnection.rollback  s"    MMOJ'r   c                F    U R                  5         U R                  U5        g)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.

Returns a dict()
N)r$  r  )r   r  s     r   r(  MySQLConnection._execute_query  s     	!!#ur   c                    U R                  SU R                  U R                  S9nUR                  U5        UR	                  5       $ )z%Send a query which only returns 1 rowT)r  r  r  )r
  r(  r'  r  fetchone)r   r  r
  s      r   r  MySQLConnection.info_query  sE    ++--  

 	u  r   c                    US   [         :X  a  U R                  R                  U5      $ US   [        :X  a  [	        U5      e[        S5      e)a  Handle a MySQL Binary Protocol OK packet

This method handles a MySQL Binary Protocol OK packet. When the
packet is found to be an Error packet, an error will be raised. If
the packet is neither an OK or an Error packet, InterfaceError
will be raised.

Returns a dict()
r   zExpected Binary OK packet)r=   rW   parse_binary_prepare_okr;   r3   r,   r  s     r   _handle_binary_ok!MySQLConnection._handle_binary_ok  sH     !9	!>>99&AA!9
"''899r   c                   U(       a  [        U5      S:  a  [        S5      eUS   [        :X  a  U R                  U5      $ US   [        :X  a  U R                  U5      $ US   [        :X  a  [        U5      eU R                  R                  U5      nU(       a  [        U[        5      (       d  [        S5      eS/U-  n[        SU5       HW  nU R                  R                  U R                  R                  U=(       d    U R                   5      U R"                  5      XE'   MY     U R                  U R                  R                  U=(       d    U R                   5      5      nX4U4$ )a  Handle a MySQL Result

This method handles a MySQL result, for example, after sending the
query command. OK and EOF packets will be handled and returned. If
the packet is an Error packet, an Error exception will be raised.

The tuple returned by this method consist of:
- the number of columns in the result,
- a list of tuples with information about the columns,
- the EOF packet information as a dictionary.

Returns tuple() or dict()
r   rj  zIllegal result set.Nr   )rm  r,   r=   r   r:   rL  r;   r3   rW   ro  r   rp  rq  rr  rX   r   r(  rs  )r   r   r  ru  rl  rv  rK  s          r   _handle_binary_result%MySQLConnection._handle_binary_result  s-   " Vq !122!9	!??6**!9
"##F++!9
"'' ~~88@:lC#@#@ !677*.,)>q,'A44!!,"D$2D2DE##GJ ( t||001SASASTUs++r   c                    UR                  SS5      nUR                  SS5      nU R                  R                  X5      nSU l        U R	                  [
        R                  USUUS9  SU l        g)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.
r  Nr  Fr,  r  r  T)r   rW   make_stmt_fetchrt  r.  r   
STMT_FETCH)r   statement_idr  r   r  r  r   s          r   cmd_stmt_fetchMySQLConnection.cmd_stmt_fetch  sp     zz.$7

?D9//C"  !%' 	 	
 "r   c           	        UR                  SS5      nUR                  SS5      nU R                  [        R                  UUUS9nU R	                  U5      n/ US'   / US'   US   S:  a  [        SUS   5       Hg  nUS   R                  U R                  R                  U R                  R                  U=(       d    U R                  5      U R                  5      5        Mi     U R                  U R                  R                  U=(       d    U R                  5      5        US	   S:  a  [        SUS	   5       Hg  nUS   R                  U R                  R                  U R                  R                  U=(       d    U R                  5      U R                  5      5        Mi     U R                  U R                  R                  U=(       d    U R                  5      5        U$ )
zPrepare a MySQL statement

This method will send the PREPARE command to MySQL together with the
given statement.

Returns a dict()
r  Nr  r  rl  
parameters
num_paramsr   num_columns)r   r.  r   STMT_PREPAREr6  rq  r  rW   rr  rX   r   r(  rs  rL  )r   	statementr   r  r  r   r  r  s           r   cmd_stmt_prepare MySQLConnection.cmd_stmt_prepare  s    zz.$7

?D9""%'	   
 ''/y!|,!#1f\23|$++NN//)),*L$:L:LM++ 4 T\\..|/Qt?Q?QRS- 1$1f]34y!((NN//)),*L$:L:LM++ 5 T\\..|/Qt?Q?QRSr   c           
     v   [        U5      n0 nUR                  SS5      nUR                  SS5      nU(       a[  [        U5       HL  u  p[        X)   [        5      (       d  M  Sn SX)   R
                  ;  nU R                  UU	X)   UUS9  U4Xi'   MN     U R                  (       d*  U R                  (       a  [        R                  " S[        S9  U R                  [        R                  -  (       aJ  U R                   R#                  UU[%        U5      UUU R&                  U R(                  U R*                  5      nO<U R                   R#                  UU[%        U5      UUU R&                  U R*                  S	9nU R-                  [.        R0                  UUUS
9nU R3                  X5      nU$ ! [         a     GNAf = f)z"Execute a prepared MySQL statementr  Nr  Tbr  r  r  )converter_str_fallback)r   r  r  )listr   r  r   r   moder  cmd_stmt_send_long_datary   r  r  r  r  r^   r   r   rW   make_stmt_executetupler   query_attrs_converter_str_fallbackr.  r   STMT_EXECUTEr9  )r   r?  datarC  r?  r   long_data_usedr  r  param_idr  r{  execute_packetr   r  s                  r   cmd_stmt_execute MySQLConnection.cmd_stmt_executeM  s    *%
zz.$7

?D9(4dnf55!F!$DN,?,?!? 00$ %1&3 1  17yN,  5 **t/@/@MMN  
 B BB!^^==j!  ,,	N "^^==j!'+'C'C > N ""!%'	   
 ++FAW * s   %F**
F87F8c           
         U R                  [        R                  [        U5      SUR	                  SS5      UR	                  SS5      S9  g)zDeallocate a prepared MySQL statement

This method deallocates the prepared statement using the
statement_id. Note that the MySQL server does not return
anything.
Fr  Nr  r<  )r.  r   
STMT_CLOSErJ   r   r   r?  r   s      r   cmd_stmt_closeMySQLConnection.cmd_stmt_close  sE     	  l#!ND9 **_d; 	 	
r   c           
        SnSn UR                  U5      nU(       a  U R                  R                  XU5      nU R                  [        R
                  USUR                  SS5      UR                  SS5      S9  U[        U5      -  nUR                  U5      nU(       a  M  U$ ! [         a  n	[        S5      U	eSn	A	ff = f)	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.

Returns int.
r2  r   Fr  Nr  )r   r,  r  r  r#  )
r1  rW   prepare_stmt_send_long_datar.  r   STMT_SEND_LONG_DATAr   rm  r  r/   )
r   r?  rW  rU  r   r8  
total_sentr9  r   r  s
             r   rO  'MySQLConnection.cmd_stmt_send_long_data  s    . 

	N))J'CCC C 11!$)!'ND!A"(**_d"C   c#h&
ii
+ #    	N"#CD#M	Ns   BB% %
C /B;;C c                    U R                  U R                  [        R                  [	        U5      UR                  SS5      UR                  SS5      S95        g)z~Reset data for prepared statement sent as long data

The result is a dictionary with OK packet information.

Returns a dict()
r  Nr  r  )r   r.  r   
STMT_RESETrJ   r   r]  s      r   cmd_stmt_resetMySQLConnection.cmd_stmt_reset  sN     	NN$$,'#ZZ=$jj$?	  	
r   c                     U R                  U R                  [        R                  5      5        U R	                  5         g! [
        [        4 a     gf = f)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.

Returns bool
TF)r   r.  r   RESET_CONNECTIONr  r.   r/   r  s    r   r  $MySQLConnection.cmd_reset_connection  sI    	OODNN9+E+EFG!!#!#34 		s   >A AAc                    U R                   (       a  U R                  5         gU R                  (       a  [        S5      eg)z'Check whether there is an unread resultzUnread result foundN)can_consume_resultsr  rt  r-   r  s    r   r$  $MySQLConnection.handle_unread_result  s1    ##  " 566  r   )3r[  rv   r|   ra   ro   r   r^   rh   ri   rz   r\   rd   rk   rm   rY   rq   re   rs   rw   rQ  r{   r   r   r   rc   r   r   r   rx   rf   rt   rW   rR  ry   rn   rr   r   rX   r_   rj   ru   r`   rg   rp   rl   rb   r   r  r  rt  r  )r   r   returnNone)ro  rp  )NNNr   NN)r   Optional[str]r   rq  r   rq  r   rp  r   z:Optional[Dict[str, Optional[Union[str, bool, List[str]]]]]r   zOptional[Dict[str, str]]ro  bool)ro  r5   )Nr   NTr   NN)r)  rp  r*  Optional[bytes]r+  rp  r   rs  r,  rr  r-  rp  r  Optional[int]r  rt  ro  zOptional[bytearray])FNN)
r6  r   r7  rr  r  rt  r  rt  ro  r   )r?  rp  ro  rp  )ro  rr  )r   r   ro  rC   )r   r   ro  rA   )NN)ra  r   r  rt  r  rt  ro  rC   )r   r   r  rt  r  rt  ro  rD   )FNNN)r{  rr  rl  Optional[List[DescriptionType]]r|  Optional[bool]r~  Optional[CMySQLPrepStmt]r   r   ro  z1Tuple[Optional[RowType], Optional[EofPacketType]])NFNNN)rz  rt  r{  rr  rl  ru  r|  rv  r~  rw  r   r   ro  z-Tuple[List[RowType], Optional[EofPacketType]])r   r   ro  rC   )FFF)r  rG   r|  rr  r  rr  r  rr  r   r   ro  rD   )r  rG   r   r   ro  z!Generator[ResultType, None, None])r  rp  ro  rC   )ro  r   r  )r  rt  ro  rp  )ro  rF   )r  rp  ro  rC   )ro  rA   )ro  rC   )
rU   rU   rU   NrU   rU   rU   rU   rU   rU   )r   r   r   r   r   r   r   rt  r   r   r   r   r   r   r   r   r   r   r   r   ro  zOptional[OkPacketType])ro  r   )r  r   ro  rp  )rS  r   ro  rp  )r  rr  ro  rp  )r  Optional[Dict[str, Any]]r  rx  ro  rp  )Fr   r   )r	  rr  r  rp  r  rp  ro  rp  )ro  rt  )NNNNNNN)r  rv  r|  rv  r  rv  r"  zOptional[Type[MySQLCursor]]r  rv  r  rt  r  rt  ro  r!   )r  r   ro  rp  )r  r   ro  zOptional[RowType])r   r   ro  zDict[str, int])r   r   r  rt  ro  EUnion[OkPacketType, Tuple[int, List[DescriptionType], EofPacketType]])r   )r?  rp  r  rp  r   r   ro  rp  )rG  r   r   r   ro  z/Mapping[str, Union[int, List[DescriptionType]]])rV   rV   r   )r?  rp  rU  zSequence[BinaryProtocolType]rC  r   r?  rp  r   r   ro  ry  )r?  rp  r   r   ro  rp  )
r?  rp  rW  rp  rU  r   r   r   ro  rp  )Br  
__module____qualname____firstlineno____doc__r[   r   r   r   r   r  r  r   
disconnectr   r.  r:  r@  propertyrC  r   rL  rg  rw  r  r}  r  r   r9   r  r  r   r  r   r  r  r  r  r  r  r   setterr  r   r   r  r  r  r  r
  r)  r-  r(  r  r6  r9  r@  rH  rY  r^  rO  rg  r  r$  __static_attributes____classcell__)r   s   @r   rR   rR      sH   &5n6(1$j #'"&"&RV/3LL  L  	L
 L PL -L 
L\*E>N"2 J  %)"& $()&*'+)N)N ")N 	)N
  )N )N #&)N $)N %)N 
)N !)NV   #(&*'+*E*E  *E $	*E
 %*E 
*E !*EXN $ $3"4"   '+'+	aa $a %	a
 
a !aF   '+'+	/;/; $/; %	/;
 
/; !/;f 37".2 1 	
 ,  
;:    $37".2BB B 1	B
 B ,B B 
7B !BH

   #ww w 	w
 w w 
w ! wr  99 9 
+	9 !9v  ! ":$#  V !V	3
A	?   !%!"$!#S'S' S' 	S'
 S' S' S' S' S'  S' S' 
 S' !S'j 7 7 __   0 ((//. 0. 486:.C0.C 4.C 
	.C`V,   $("#'48%)&*'+P P P !	P
 2P #P $P %P 
Pd&(
!:   ;?&,&,+8&,	N&, !&,V "" " 	"
 
"0  ++ + 
9	+ !+Z  .0!?? +? 	?
 ? ? 
O? ?B

 
 
	
&++ + 	+
 + 
+Z

 
 
	
(7 7r   rR   )jr}  
__future__r   r  r   r   r   r  r  r  decimalr   ior   typingr   r   r   r	   r
   r   r   r   r   r   r   r   rU   r   _decoratingr   r   
_scriptingr   	abstractsr   authenticationr   r   	constantsr   r   r   r   r   r   
conversionr    r
  r!   r"   r#   r$   r%   r&   r'   r(   errorsr)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   networkr5   r6   r7   opentelemetry.constantsr8   !opentelemetry.context_propagationr9   protocolr:   r;   r<   r=   r>   r  r?   r@   rA   rB   rC   rD   rE   rF   rG   utilsrH   rI   rJ   rK   rL   rM   rN   opentelemetry.instrumentationrO   rP   rR   rV   r   r   <module>r     s   > 5 "   	   
        N 2 . ?  '	 	 	     A A 1 G 
 
 
  )Oq7- q7r   