
    *hȡ                        S 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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  SSKJrJr  SSKJrJrJrJrJr  SS	KJr  SS
K J!r!J"r"J#r#J$r$J%r%  SSK&J'r'  SSK(J)r)J*r*J+r+J,r,J-r-J.r.J/r/  SSK0J1r1J2r2J3r3  Sr4 SSK5r5SSK5J6r6  SSK7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?  Sr4SSKBJCrC  SSKDJErE  \C(       a  SSKFJGrGJHrH   " S S\5      rIg! \@ a  rA\@" S\A S35      \AeSrACAff = f)z'Connection class using the C Extension.    N)
AnyBinaryIODictListNoReturnOptionalSequenceTupleTypeUnion   )version)cmd_refresh_verify_options)CMySQLPrepStmtMySQLConnectionAbstract)
ClientFlag	FieldFlag	FieldType
ServerFlagShutdownType)MySQLConverter)InterfaceErrorInternalErrorOperationalErrorProgrammingErrorget_mysql_exception)MySQLProtocol)CextEofPacketTypeCextResultTypeDescriptionTypeParamsSequenceOrDictTypeRowTypeStatsPacketType
StrOrBytes)import_objectwarn_ciphersuites_deprecatedwarn_tls_version_deprecatedF)MySQLInterfaceError)CMySQLCursorCMySQLCursorBufferedCMySQLCursorBufferedDictCMySQLCursorBufferedRawCMySQLCursorDictCMySQLCursorPreparedCMySQLCursorPreparedDictCMySQLCursorRawTz2MySQL Connector/Python C Extension not available ())OTEL_ENABLED)with_context_propagation)end_spanrecord_exception_eventc                   <  ^  \ rS rSrSrS\SS4U 4S jjrSjS jrSjS jr\	S\
4S	 j5       rS
\SS4S jr\R                  R                   S\SS4S j5       r\	S\4S j5       r\R                   S\SS4S j5       r\	S\\
   4S j5       r\R                   S\
SS4S j5       r\	S\\
   4S j5       r\R                   S\
SS4S j5       r\	S\4S j5       r\R                   S\SS4S j5       r\	S\4S j5       rSjS jrSjS jr\rS\4S jrS\4S jrSkS\S\
S\
SS4S jjrS \SS4S! jrS"\S\\    4S# jr!\	S\\
   4S$ j5       r"     SlS%\\
   S&\S'\\#\$      S(\\   S)\\%   S\S\&\#\    \\'   4   4S* jjr(    SmS&\S'\\#\$      S(\\   S)\\%   S\S\&\\    \\'   4   4S+ jjr)S\\   4S, jr*SjS- jr+SjS. jr,SjS/ jr-S0\SS4S1 jr. SnS)\\%   S\/4S2 jjr0S\\'   4S3 jr1S4\2S\S\%4S5 jr3\4S6\%S7\S\S\\5\'\/4      4S8 j5       r6S6\%S\SS4S9 jr7S6\%S\SS4S: jr8\4   SoS"\S(\\   S;\S<\S\S\\5\'\/4      4S= jj5       r9\9r:       SpS;\\   S(\\   S>\\   S?\\;\<      S@\\   SA\\
   SB\\
   S\<4SC jjr=\	S\
4SD j5       r>\	S\
4SE j5       r?\	S\4SF j5       r@\	S\4SG j5       rA\	S\4SH j5       rBSI\CS\5\D\2   \E\2\24   4   4SJ jrFSjSK jrG          SqSL\SM\S0\S \\
   SN\SO\SP\SQ\\   SR\\   SS\\   SS4ST jjrHS\4SU jrI\J" 5       SV\
S\\'   4SW j5       rKSjSX jrLSnSY\\
   SS4SZ jjrMS\N4S[ jrOS\\
SS4S] jrPS\Q4S^ jrRS\Q4S_ jrSS`\S\S\Q4Sa jrTS6\%Sb\
Sc\US\S\Q4
Sd jrVSrS>\SS4Se jjrW  SsSf\\E\\4      Sg\\E\\4      SS4Sh jjrXSirYU =rZ$ )tCMySQLConnectiono   z6Class initiating a MySQL Connection using Connector/C.kwargsreturnNc                   > [         (       d  [        S5      eSU l        / U l        [        R
                  R                  [        R
                  R                  [        R
                  R                  [        R                  5      5      SSS5      U l        [        R                  " 5       S:X  a[  [        R
                  R                  U R                  5      (       d-  [        R
                  R                  S5      (       a  SOSU l        SU l        [         TU ]E  5         U(       a   U R$                  " S	0 UD6  gg! [&         a    U R)                  5         e f = f)
Initializationz0MySQL Connector/Python C Extension not availableNmysqlvendorpluginLinuxz/usr/lib64/mysql/pluginz/usr/lib/mysql/plugin )HAVE_CMYSQLRuntimeError_cmysql_columnsospathjoindirnameabspath_mysql_connector__file___plugin_dirplatformsystemexists	convertersuper__init__connect	Exceptionclose)selfr9   	__class__s     W/var/www/auris/envauris/lib/python3.13/site-packages/mysql/connector/connection_cext.pyrS   CMySQLConnection.__init__r   s   {QRR  	 02 "GGOOBGGOO,<,E,EFG	!
 ??'77>>$"2"233 ww~~&?@@ .0   48&v&   

s   &D: :Ec                 B   [         R                  R                  S5      nUS   S:X  a  SnOSnU R                  R	                  SUSR                  [         R                  SS  Vs/ s H  n[        U5      PM     sn5      [        R                  " 5       S	.5        g
s  snf )z!Add default connection attributes r   GPLv2zGPL-2.0
Commercialzmysql-connector-python.   )_connector_name_connector_license_connector_version_source_hostN)
r   LICENSEsplit_conn_attrsupdaterH   VERSIONstrsocketgethostname)rW   license_chunksclient_licensexs       rY   _add_default_conn_attrs(CMySQLConnection._add_default_conn_attrs   s     ..s3!'&N)N#;&4&)hhPQRS@T/U@T1A@T/U&V & 2 2 4		
 0Vs   %Bc           	      t   U R                   R                  5       U R                   R                  5       U R                   R                  5       SSSSU R                   R	                  5       S.U l        U R                  U R
                  S   5      U l        U R                  R                  U R                  5        g)z<Gather information of the MySQL server before authenticationN)protocolserver_version_originalserver_threadidcharsetserver_statusauth_plugin	auth_datacapabilitiesrt   )
rD   get_proto_infoget_server_info	thread_idst_server_capabilities
_handshake_check_server_version_server_version_character_setset_mysql_versionrW   s    rY   _do_handshakeCMySQLConnection._do_handshake   s     335'+||'C'C'E#||557! LL??A	
  $99OO56 
 	--d.B.BC    c                 6    U R                   R                  5       $ )z6Returns the server status attribute of MYSQL structure)rD   st_server_statusr   s    rY   _server_statusCMySQLConnection._server_status   s     ||,,..r   rG   c                 ^    U R                   (       a  U R                   R                  U5        gg)z:set local_infile_in_path

Set allow_local_infile_in_path.
N)rD   !set_load_data_local_infile_option)rW   rG   s     rY   set_allow_local_infile_in_path/CMySQLConnection.set_allow_local_infile_in_path   s"     <<LL::4@ r   valuec                     Xl         U R                  (       a  U R                  R                  U5        U R                  (       a  U R                  R	                  U5        g g N)_use_unicoderD   use_unicoderQ   set_unicoderW   r   s     rY   r   CMySQLConnection.use_unicode   s?    !<<LL$$U+>>NN&&u- r   c                 4    U R                  S5      S   nUS:H  $ )z#Get whether autocommit is on or offzSELECT @@session.autocommitr   r   
info_queryr   s     rY   
autocommitCMySQLConnection.autocommit   s"      =>qAzr   c                     U R                   R                  U5        Xl        g! [         aU  n[	        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)zToggle autocommiterrnomsgsqlstateN)rD   r   _autocommitr(   hasattrr   r   r   r   r   rj   rW   r   errs      rY   r   r      sr    	4LL##E*$" 	4sG$$)II377S\\ !S*3	4s   !$ 
BAA>>Bc                     U R                   $ r   )_read_timeoutr   s    rY   read_timeoutCMySQLConnection.read_timeout   s    !!!r   timeoutc                     [        S5      e)Nz
            The use of read_timeout after the connection has been established is unsupported
            in the C-Extension
            r   rW   r   s     rY   r   r          
 	
r   c                     U R                   $ r   )_write_timeoutr   s    rY   write_timeoutCMySQLConnection.write_timeout   s    """r   c                     [        S5      e)Nz
            Changes in write_timeout after the connection has been established is unsupported
            in the C-Extension
            r   r   s     rY   r   r      r   r   c                 *    U R                  S5      S   $ )zGet the current databasezSELECT DATABASE()r   r   r   s    rY   databaseCMySQLConnection.database   s     23A66r   c                      U R                   R                  U5        g! [         aU  n[        US5      (       a*  [	        UR
                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)zSet the current databaser   r   N
rD   	select_dbr(   r   r   r   r   r   r   rj   r   s      rY   r   r      sl    	4LL""5)" 	4sG$$)II377S\\ !S*3	4    
A=AA88A=c                 N    [        U R                  [        R                  -  5      $ )z'MySQL session has started a transaction)boolr   r   STATUS_IN_TRANSr   s    rY   in_transactionCMySQLConnection.in_transaction
  s      D''**D*DDEEr   c                 
   U R                   R                  U R                  5      S   n[        R                  " U R
                  U R                  UU R                  =(       d    SU R                  U R                  U R                  S9U l        U R                  [        R                  5      (       d  0 U l        0 SU R                   _SU R"                  _SU R$                  _SU R&                  _SU R(                  _SU R*                  _S	U R,                  _S
U R.                  _SU R0                  _SU R2                  _SU R4                  _SS_SU R                  _SU R6                  _SU R8                  _SU R:                  _SU R<                  _[?        U R@                  [B        5      (       a  [E        U R@                  5      OU R@                  U RF                  U RH                  (       a  U RH                  OSU RJ                  (       a  U RJ                  OSS.EnU RL                  RO                  S5      nUb   URQ                  SS9  SRS                  U5      nU RL                  RO                  S5      bF  U RL                  RO                  S5      S   =(       d    S nU RL                  RO                  S5      S   nOS nS nUb  SU;   a	  U(       d  SnU RT                  (       d  URW                  U RL                  RO                  S5      U RL                  RO                  S5      U RL                  RO                  S5      UUUU RL                  RO                  S 5      =(       d    S!U RL                  RO                  S"5      =(       d    S!U RT                  S#.	5        [X        RZ                  S$:X  a  U R\                  S%:X  a  SUS&'    U R                  R^                  " S*0 UD6  U R`                  U R                  l1        U Rd                  (       a  U R`                  U Rd                  l3        U Rw                  5         U RT                  (       d  [k        U R                  S)5      (       a  [y        U R                  Rz                  5      (       a]  U R                  R{                  5       n[}        U RL                  RO                  S/ 5      5       H  n[        U5        [        Xx5        M     g g g g ! [h         aU  n[k        US'5      (       a*  [m        URn                  URp                  URr                  S(9Ue[u        [C        U5      5      UeS nAff = f)+Nr   )bufferedrawcharset_nameconnection_timeoutr   rx   
plugin_dirhostuserpassword	password1	password2	password3r   portclient_flagsunix_socketcompressssl_disabledT
conn_attrslocal_infileload_data_local_diroci_config_fileoci_config_profile)webauthn_callbackopenid_token_filer   r   tls_versions)reverse,tls_ciphersuitesr   zTLSv1.3TLS_AES_256_GCM_SHA384cacertkeyverify_certFverify_identity)	ssl_cassl_certssl_keyssl_cipher_suitesr   tls_cipher_suitesssl_verify_certssl_verify_identityr   ntMySQLKerberosAuthPluginuse_kerberos_gssapir   r   get_ssl_cipherrA   )Ar   get_info_charset_idrK   MySQL	_buffered_raw_connection_timeoutr   _auth_pluginrM   rD   isset_client_flagr   CONNECT_ARGSrg   _host_user	_password
_password1
_password2
_password3	_database_portr   _unix_socket	_compress_allow_local_infile_allow_local_infile_in_path_oci_config_file_oci_config_profile
isinstance_webauthn_callbackrj   r%   _openid_token_filer   r   _sslgetsortrH   _ssl_disabledrh   rF   name_auth_plugin_classrT   _converter_str_fallbackconverter_str_fallbackrQ   str_fallbackr(   r   r   r   r   r   r   r   callabler   setr'   r&   )	rW   r   
cnx_kwargsr   ssl_ciphersuitesr   r   ciphertls_versions	            rY   _open_connection!CMySQLConnection._open_connection  s   **33D4D4DEaH'--^^		% $ 8 8 =A(())''
 %%j&=&=>>!D
DJJ
DJJ
 
 	

 
 
 
 DJJ
 D--
 4,,
 
 D
 $**
 D44
 "4#C#C
  t44!
" !$":":#
( d55s;; d556,,!%!8!8262D2DD..!484G4GT00Q3

8 yy}}^4#d+88L1L99==+,8		01!4<   $yy}}-?@   $#$\)$7!!"iimmD1 $		f 5#yy}}U3)9$0)9'+yy}}]'C'Lu+/99==9J+K+Tu$($6$6
 77d?t66:SS04J,-
	4LL  .:.262N2NDLL/~~.2.J.J+ 	 ""&6774455 \\002F"499==#DE+K8,VA  F 6 8 # # 	4sG$$)II377S\\ !S*3	4s   ;A#S 
T=(AT88T=c                    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        g g ! [         av  n[        (       a  [        U R                   U5        [        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [!        U5      5      UeS nAff = f! [        (       a  [#        U R                   5        f f = f)Nr   r   r   )_spanis_recordingr5   sysexc_inforD   free_resultrV   r(   r2   r   r   r   r   r   r   rj   r4   )rW   r   s     rY   rV   CMySQLConnection.close}  s    ::$**1133"4::s||~a/@A||	%LL  |$  # 	4|&tzz37sG$$)II377S\\ !S*3	4 |$ s%   0*B= =
D=A1D88D==E   #E#c                 @    U R                   R                  5       (       + $ )z8Return True if the connection to MySQL Server is closed.)rD   	connectedr   s    rY   	is_closedCMySQLConnection.is_closed  s    <<))+++r   c                 z    U R                   (       a*  U R                  5         U R                   R                  5       $ g)z;Reports whether the connection to MySQL Server is availableF)rD   handle_unread_resultpingr   s    rY   is_connectedCMySQLConnection.is_connected  s+    <<%%'<<$$&&r   	reconnectattemptsdelayc                     U R                  5          U R                  R                  5       nU(       a  g U(       a  U R	                  X#S9  g[        S5      e! [         a     N.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.
N)r)  r*  z$Connection to MySQL is not available)r$  rD   r%  AttributeErrorr(  r   )rW   r(  r)  r*  r   s        rY   r%  CMySQLConnection.ping  sg     	!!#	))+I   NNHN: !GHH  		s   A 
A$#A$rv   c                 :    U R                   R                  U5        g)z;Sets the default character set name for current connection.N)rD   set_character_set)rW   rv   s     rY   set_character_set_name'CMySQLConnection.set_character_set_name  s    &&w/r   queryc                 ,   Sn U R                   R                  U5        U R                   R                  (       a^  U R                   R                  5       nU R                   R                  5       (       a%  U R                   R	                  5         [        S5      eU R                   R	                  5         U$ ! [         aU  n[        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)z%Send a query which only returns 1 rowrA   z'Query should not return more than 1 rowr   r   N)rD   r2  have_result_set	fetch_rowr  r   r(   r   r   r   r   r   rj   )rW   r2  	first_rowr   s       rY   r   CMySQLConnection.info_query  s    		4LLu%||++ LL224	<<))++LL,,.()RSSLL$$&  # 	4sG$$)II377S\\ !S*3	4s   B.B4 4
D>ADDc                 X     U R                   R                  5       $ ! [         a     gf = f)zMySQL connection IDN)rD   r}   r(   r   s    rY   connection_idCMySQLConnection.connection_id  s/    	<<))++" 		s    
))countbinarycolumnsr   	prep_stmtc                    U(       a  UR                   OU R                  nU R                  (       a  U(       d  [        S5      eUc  U R                  n/ nUb  US::  a  [        S5      eSn	 U(       a  UR                  OU R                  R                  n
U R                  (       d  U(       a  U R                  R                  S5        U
" 5       nU(       Ga+  [        U5      nU R                  R                  5       (       dX  U(       dQ  [        U R                  5       H8  u  pUS   [        R                  :X  d  M  [        R                  " X   5      X'   M:     U R                  (       d[  U R                  (       aJ  [        U5       H;  u  pU(       a  M  U R                  R!                  U R                  U   X   5      X'   M=     UR#                  [%        U5      5        U	S-  n	U(       a  X:X  a  OU
" 5       nU(       a  GM+  U(       dG  U R'                  U5      S   nU(       a  UR)                  5         SU l        OU R)                  5          X4$ SnX4$ ! [,         a}  nU(       a  UR)                  5         OU R)                  5         [/        US	5      (       a*  [1        UR2                  UR4                  UR6                  S
9Ue[9        [;        U5      5      UeSnAff = f)z8Get all or a subset of rows returned by the MySQL serverzNo result set availableNr   z$count should be 1 or higher, or NoneTr   eofFr   r   )r4  unread_resultrD   r   r   r,  r5  rQ   r   list	enumeraterE   r   VECTORr   _vector_to_python	to_pythonappendtuplefetch_eof_columnsr  _unread_resultr(   r   r   r   r   r   r   rj   )rW   r;  r<  r=  r   r>  r9   rA  rowscounterr5  rowidsc__eofr   s                    rY   get_rowsCMySQLConnection.get_rows  sH    6?	11DDVDV 9::;))C! !GHH:	4/8	++dll>T>TI~~   &+C3i||''))# #,DMM":q6Y%5%55%3%E%Ecf%MCF #; yyT^^ )#"s%)^^%=%=dmmA>NPSPV%WCF !/ E#J'1W-k9 #: 484J4J94U5 ))+*/D'$$& z  z # 		4%%'  "sG$$)II377S\\ !S*3		4s5   +CI :AI A+I A
I I 
KA8KKc                 r     U R                  SUUUUS9u  pgU(       a  US   U4$ SU4$ ! [         a     gf = f)z.Get the next rows returned by the MySQL serverr   )r;  r<  r=  r   r>  r   NNN)rR  
IndexError)rW   r<  r=  r   r>  r9   rK  r@  s           rY   get_rowCMySQLConnection.get_row5  sZ    	 # & ID Q~%#; 	 	 s   ") ) 
66c                     U R                   (       a4  U R                   R                  5         U R                   R                  5       $ g)zReads the next resultN)rD   consume_resultnext_resultr   s    rY   r[  CMySQLConnection.next_resultM  s/    <<LL'')<<++--r   c                 \    U R                   (       a  U R                   R                  5         gg)zFrees the resultN)rD   r  r   s    rY   r  CMySQLConnection.free_resultT  s    <<LL$$& r   c                 |    U R                   (       a+  U R                  5         U R                   R                  5         gg)zCommit current transactionN)rD   r$  commitr   s    rY   r`  CMySQLConnection.commitY  s*    <<%%'LL! r   c                     U R                   (       a5  U R                   R                  5         U R                   R                  5         gg)zRollback current transactionN)rD   rZ  rollbackr   s    rY   rc  CMySQLConnection.rollback_  s.    <<LL'')LL!!# r   r   c                      U R                   R                  U5        g! [         aU  n[        US5      (       a*  [	        UR
                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)zChange the current databaser   r   Nr   )rW   r   r   s      rY   cmd_init_dbCMySQLConnection.cmd_init_dbe  sl    	4LL""8," 	4sG$$)II377S\\ !S*3	4r   c                 4   U(       a  UR                   OU R                  R                   nU(       d  [        S5      eU(       a  UR                  5       OU R                  R                  5       n/ U l        U Hl  nU R                  R                  US   [        US   5      SSSS[        US   5      ) [        R                  -  [        US   5      [        US   5      4	5        Mn     U R                  U R                  R                  5       S.U R                  S.$ )	z Fetch EOF and column informationNo result set      N	      )status_flagwarning_count)r@  r=  )r4  rD   r   fetch_fieldsrE   rG  intr   NOT_NULLr   st_warning_count)rW   r>  r4  fieldscols        rY   rI  "CMySQLConnection.fetch_eof_columnsp  s    
 *3I%%8T8T 	  11-6'')DLL<U<U<WCMM  FAKQ[L9#5#55AKAK
 "  $22!%!>!>!@ }}
 	
r   c                 
   U R                   (       ar  U R                   R                  5       U R                   R                  5       U R                   R                  5       U R                   R	                  5       U R
                  S.$ g)z Fetch EOF and status information)ro  field_count	insert_idaffected_rowsrw   N)rD   rs  st_field_country  rz  r   r   s    rY   fetch_eof_status!CMySQLConnection.fetch_eof_status  sa    <<!%!>!>!@#||::<!\\335!%!;!;!=!%!4!4  r   	statementc                 n   U R                   (       d  [        S5      e U R                   R                  U5      nU R                  Ul        [        U5      $ ! [         aU  n[        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)zPrepares the SQL statementMySQL Connection not availabler   r   N)rD   r   stmt_preparer  r  r   r(   r   r   r   r   r   r   rj   )rW   r~  r9   stmtr   s        rY   cmd_stmt_prepare!CMySQLConnection.cmd_stmt_prepare  s     ||"#CDD		4<<,,Y7D*.*F*FD'!$''" 	4sG$$)II377S\\ !S*3	4s   6A 
B4AB//B4statement_idargsc                     UR                   " USU R                  06  / U l
        UR                  (       d  SU l        U R                  5       $ SU l        U R                  U5      $ ! [         aU  n[        US5      (       a*  [	        UR
                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)zExecutes the prepared statementquery_attrsr   r   NFT)stmt_executer  r(   r   r   r   r   r   r   rj   rE   r4  rJ  r|  rI  )rW   r  r  r9   r   s        rY   cmd_stmt_execute!CMySQLConnection.cmd_stmt_execute  s    	4%%tJ9I9IJ ++"'D((**"%%l33 # 	4sG$$)II377S\\ !S*3	4s   A% %
C/AB??Cc                 "   U R                   (       a  [        S5      e UR                  5         g! [         aU  n[	        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)zCloses the prepared statementUnread result foundr   r   N)rJ  r   
stmt_closer(   r   r   r   r   r   r   rj   rW   r  r9   r   s       rY   cmd_stmt_closeCMySQLConnection.cmd_stmt_close  }      566	4##%" 	4sG$$)II377S\\ !S*3	4   / 
BAB		Bc                 "   U R                   (       a  [        S5      e UR                  5         g! [         aU  n[	        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)zResets the prepared statementr  r   r   N)rJ  r   
stmt_resetr(   r   r   r   r   r   r   rj   r  s       rY   cmd_stmt_resetCMySQLConnection.cmd_stmt_reset  r  r  r   raw_as_stringc                    U R                  5         Uc  U R                  n [        U[        5      (       d  UR	                  S5      nXl        S U l        U R                  R                  UUUUU R                  S9  / U l        U R                  R0                  (       d  U R3                  5       $ U R5                  5       $ ! [         aU  n[        US5      (       a*  [        UR                  UR                  UR                  S9Ue[!        [#        U5      5      UeS nAf[$         aJ  nU R&                  (       a  U R&                  OU R(                   SU R*                   3n[-        SUS4S9UeS nAff = f)	Nzutf-8)r   r   r  r  r   r   :i  zConnection not available.)r   values)r$  r   r  bytesencode_query_local_infile_filenamesrD   r2  r  r(   r   r   r   r   r   r   rj   r,  r   r   r   r   rE   r4  r|  rI  )rW   r2  r   r   r  r9   r   addrs           rY   	cmd_queryCMySQLConnection.cmd_query  sS    	!!#;))C	eU++W-  K+/D(LL!+ ,,  * ||++((**%%''' # 	4sG$$)II377S\\ !S*3 	%)%6%6!!tzzl!DJJ<<X  #D*E#F		s&   AB= =
E.ADE.$AE))E.preparedcursor_class
dictionaryr   r   c                    U R                  U5        U R                  5       (       d  [        S5      eU(       d  U(       a  [        R                  " S[
        S9  Ub(  [        U[        5      (       d  [        S5      eU" U 5      $ U=(       d    U R                  nU=(       d    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   " 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 using C Extension

By default, CMySQLCursor 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_cext.CMySQLCursor.

Raises ProgrammingError when cursor_class is not a subclass of
CMySQLCursor. Raises ValueError when cursor is not available.

Returns instance of CMySQLCursor or subclass.

:param buffered: Return a buffering cursor
:param raw: Return a raw cursor
:param prepared: Return a cursor which uses prepared statements
:param cursor_class: Use a custom cursor class
:param dictionary: Rows are returned as dictionary
:return: Subclass of CMySQLCursor
:rtype: CMySQLCursor or subclass
MySQL Connection not available.zsThe use of read_timeout after the connection has been established is unsupported
                in the C-Extension)categoryNz=Cursor class needs be to subclass of cursor_cext.CMySQLCursorr   Tr      rj     )r   r   r  r`   rj     r     )r   r   r  r  z*Cursor not available with given criteria: z, )r$  r&  r   warningswarnWarning
issubclassr)   r   r   r   r*   r0   r,   r-   r+   r.   r/   KeyError
ValueErrorrH   range)rW   r   r   r  r  r  r   r   cursor_typetypesr  rN  s               rY   cursorCMySQLConnection.cursor"  sv   J 	!!(+  """#DEE=MM& 
 #lL99&S  !$''-t~~TYYt1K$;1K1Kt2K #&'$(	
	&-- 	@D<))eAhVha:PTU:UWTWhVWX 	s   	D *E(8EEE(c                     U R                   R                  (       d  [        S5      eU R                   R                  5       $ )z,Returns number of rows of current result setri  )rD   r4  r   num_rowsr   s    rY   r  CMySQLConnection.num_rowsw  s/     ||++ 11||$$&&r   c                 Z    U R                   (       d  gU R                   R                  5       $ )zReturns number of warningsr   )rD   ro  r   s    rY   ro  CMySQLConnection.warning_count  s!     ||||))++r   c                 R    U R                   (       d  gU R                   R                  $ )z"Check if a result set is availableF)rD   r4  r   s    rY   result_set_available%CMySQLConnection.result_set_available  s     ||||+++r   c                     U R                   $ )z)Check if there are unread results or rows)r  r   s    rY   rA  CMySQLConnection.unread_result  s     (((r   c                 6    U R                   R                  5       $ )zCheck if there are more results)rD   more_resultsr   s    rY   r  CMySQLConnection.more_results  s     ||((**r   paramsc           
         / n[        U[        [        45      (       a  U R                  (       aj  U Vs/ s H[  nU R                  R	                  U R                  R                  U R                  R                  U5      U R                  5      5      PM]     nnU$ U R                  R                  " U6 n U$ [        U[        5      (       a  0 nU R                  (       a  UR                  5        Hm  u  pCU R                  R	                  U R                  R                  U R                  R                  U5      U R                  5      5      X$R                  5       '   Mo     U$ UR                  5        H3  u  pCU R                  R                  U5      S   X$R                  5       '   M5      U$ [        S[        U5      R                   SU S35      es  snf )zPrepare parameters for statements

This method is use by cursors to prepared parameters found in the
list (or tuple) params.

Returns dict.
r   zCould not process parameters: (z)), it must be of type list, tuple or dict)r  rB  rH  rQ   quoteescapeto_mysql	_sql_moderD   convert_to_mysqldictitemsr  r   type__name__)rW   r  resultr   r   s        rY   prepare_for_mysql"CMySQLConnection.prepare_for_mysql  s    :<ftUm,,~~ "( "( NN((-- NN33E:DNN
 "(  8 ' 66?& % %%F~~"(,,.JC+/>>+?+?-- NN33E:DNN,F::<( #1  #),,.JC+/<<+H+H+OPQ+RF::<( #1  #0f1F1F0Gq Q: : /s   A"Gc                 8    U R                   R                  5         g)z\Consume the current result

This method consume the result by reading (consuming) all rows.
N)rD   rZ  r   s    rY   consume_results CMySQLConnection.consume_results  s    
 	##%r   usernamer   r   r   r   r   r   r   c                     U R                   R                  UUUUUUUU	U
5	        Ub7  [        U[        5      (       d  [        S5      eUS:  a  [        S5      eX@l        Xl        U R                  5         g! [         aU  n[        US5      (       a*  [	        UR
                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)z!Change the current logged in userr   r   Nzcharset must be an integerr   z2charset should be either zero or a postive integer)rD   change_userr(   r   r   r   r   r   r   rj   r  rq  r  r   r   _post_connection)rW   r  r   r   rv   r   r   r   r   r   r   r   s               rY   cmd_change_user CMySQLConnection.cmd_change_user  s    	4LL$$"!
* gs++ !=>>{ !UVV&
! # 	4sG$$)II377S\\ !S*3	4s   #A6 6
C ACCc                 h    U R                   R                  5       nU(       a  U R                  5         U$ )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
)rD   reset_connectionr  )rW   ress     rY   cmd_reset_connection%CMySQLConnection.cmd_reset_connection  s*     ll++-!!#
r   optionsc                 >    U R                  5         U R                  R                  U5        U R                  5       $ ! [         aU  n[	        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [        U5      5      UeS nAff = f)Nr   r   )r$  rD   refreshr(   r   r   r   r   r   r   rj   r|  )rW   r  r   s      rY   cmd_refreshCMySQLConnection.cmd_refresh  s    	4%%'LL  ) $$&& # 	4sG$$)II377S\\ !S*3	4s   += 
BABBc                 $    U R                  5         g)z,Close the current connection with the serverN)rV   r   s    rY   cmd_quitCMySQLConnection.cmd_quit  s    

r   shutdown_typec                    U R                   (       d  [        S5      eU(       a)  [        R                  " U5      (       d  [	        S5      eUnO[        R
                  n U R                   R                  U5        U R                  5         g! [         aU  n[        US5      (       a*  [        UR                  UR                  UR                  S9Ue[	        [        U5      5      UeSnAff = f)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.
r  zInvalid shutdown typer   r   N)rD   r   r   r   r   SHUTDOWN_DEFAULTshutdownr(   r   r   r   r   r   rj   rV   )rW   r  levelr   s       rY   cmd_shutdownCMySQLConnection.cmd_shutdown  s     ||"#CDD((77$%<==!E 11E	4LL!!%( 	

 # 	4sG$$)II377S\\ !S*3	4s   B
 

C)AC$$C)c                 X   U R                  5          U R                  R                  5       n[        5       R	                  USS9$ ! [
        [        4 aU  n[        US5      (       a*  [        UR                  UR                  UR                  S9Ue[        [        U5      5      UeSnAff = f)z'Return statistics from the MySQL serverF)with_headerr   r   N)r$  rD   statr   parse_statisticsr(   r   r   r   r   r   r   rj   )rW   r  r   s      rY   cmd_statisticsCMySQLConnection.cmd_statistics1  s    !!#	4<<$$&D ?33De3LL#^4 	4sG$$)II377S\\ !S*3	4s   1A B)AB$$B)	mysql_pidc                 l    [        U[        5      (       d  [        S5      eU R                  SU 35        g)zKill a MySQL processzMySQL PID must be intzKILL N)r  rq  r  r  )rW   r  s     rY   cmd_process_kill!CMySQLConnection.cmd_process_kill?  s.    )S))455yk*+r   c                     [         e)zSend the DEBUG commandNotImplementedErrorr   s    rY   	cmd_debugCMySQLConnection.cmd_debugE      !!r   c                     [         e)zSend the PING commandr  r   s    rY   cmd_pingCMySQLConnection.cmd_pingI  r   r   
statementsc                     [         e)z/Send one or more statements to the MySQL serverr  )rW   r  r9   s      rY   cmd_query_iterCMySQLConnection.cmd_query_iterM  r   r   param_iddatac                     [         e)zSend data for a columnr  )rW   r  r  r	  r9   s        rY   cmd_stmt_send_long_data(CMySQLConnection.cmd_stmt_send_long_dataQ  s
     "!r   c                     USL a  U R                   OU R                  nU R                  (       a  U R                  5         gU(       a  [	        S5      eg)z'Check whether there is an unread resultTr  N)rJ  rA  can_consume_resultsr  r   )rW   r  rA  s      rY   r$  %CMySQLConnection.handle_unread_result[  sE    /74/?++TEWEW##  " 566 r   user_variablessession_variablesc                    U R                  5       (       d  [        S5      eU R                  5       (       dt   U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  5	        U(       d  U(       a  U R                  5       nU(       a0  UR!                  5        H  u  pEUR#                  SU S3U45        M     U(       a0  UR!                  5        H  u  pEUR#                  SU S3U45        M     UR%                  5         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.
r  zSET @`z` = %szSET SESSION `N)r&  r   r  r  r   r   r   r   r   r   r   r  r  r   r(  r  r  executerV   )rW   r  r  curr   r   s         rY   reset_sessionCMySQLConnection.reset_sessionc  s$   (   """#DEE((**!$$JJNNNN$$OOOOOO)),,
 .++-C"0"6"6"8JCKK&V 4uh? #9 "3"9"9";JCKK-uF ;eXF #<IIK / $ ! !s   A3E E%$E%)r   r   rD   rE   rg   r   r  rM   r  r   rJ  r   r   rQ   )r:   N)Fr   r   )NFNNN)FNNNr   )NFF)NNNNNNN)
 r  r  Nr  r  r  NNN)FrU  )[r  
__module____qualname____firstlineno____doc__r   rS   rp   r   propertyrq  r   rj   r   r   r   setterr   r   r   r   r   r   r   r  rV   
disconnectr!  r&  r%  r0  r$   r"   r   r9  r   r    r   r
   r   rR  rW  r[  r  r`  rc  rf  r   rI  r|  r  r  r3   r   r  r  r  r  _execute_queryr   r)   r  r  ro  r  rA  r  r!   r	   r   r  r  r  r  r   r  r  r  r#   r  r  r   r  r  r  r   r  r$  r  __static_attributes____classcell__)rX   s   @rY   r7   r7   o   s   @  B
"D$ / / /A3 A4 A ((//. .$ . 0. D  
 
4 
4 
4 
4 "hsm " " 
C 
D 
 
 #x} # # 
S 
T 
 
 7# 7 7 __	4c 	4d 	4 	4 F F FlB\%. J,4 ,d Id Ic Ic IRV I:0c 0d 0
 x/@ ( x}    $37".2R}R R $/0	R
 d^R N+R R 
tG}h'899	:Rl 37".2   $/0  d^	 
 N+    
x (+<"==	> 0Xd^ '
"$	4C 	4D 	4 59!
!.1!
	!
F(+<"= 44 4 
	4( 4$4 4 	4
 
%)>9:	;4 424$4 4 
	4"4$4 4 
	4"  ##-(-( d^-( 	-(
 -( -( 
%)>9:	;-( -(^ N $("#'59%)&*'+S4.S d^S 4.	S
 tL12S TNS smS  }S 
Sj '# ' ' ,s , , ,d , , )t ) ) +d + +).)	xUE\ 22	3)V& !%)-,0+/+ +  +  	+ 
 #+  +  +  +  "#+  %SM+  $C=+  
+ Zd   !'3 '84E+F ' "'(3- 4 44 4,# ,$ ,"8 ""( "" " " ""$" " 	"
 " 
"7T 7d 7 486:/ c3h0/ $DcN3/ 
	/ /r   r7   )Jr  rF   rN   rk   r  r  typingr   r   r   r   r   r   r	   r
   r   r   r  r   _decoratingr   	abstractsr   r   	constantsr   r   r   r   r   
conversionr   errorsr   r   r   r   r   rs   r   r  r   r   r    r!   r"   r#   r$   utilsr%   r&   r'   rB   rK   r(   cursor_cextr)   r*   r+   r,   r-   r.   r/   r0   ImportErrorexcopentelemetry.constantsr2   !opentelemetry.context_propagationr3   opentelemetry.instrumentationr4   r5   r7   rA   r   rY   <module>r/     s   > . 	   
     3 > Q Q &  $    4	 	 	 K 2 GOc. c  

<SECs   
 C C)C$$C)