o
    g                  
   @   s  d Z ddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZmZmZmZmZ ddlmZ ddlmZ ddlmZmZ ddlmZmZmZmZmZmZ dd	lm Z  dd
l!m"Z"m#Z#m$Z$m%Z%m&Z& ddl'm(Z( ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2m3Z3m4Z4 dZ5z*ddl6Z6ddl6m7Z7 ddl8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZD dZ5W n eEy ZF z	eEdeF deFdZF[Fww ddlGmHZH ddlImJZJ eHrddlKmLZLmMZM G dd deZNdS )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-raise_warning_against_deprecated_cursor_class)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CMySQLCursorBufferedNamedTupleCMySQLCursorBufferedRawCMySQLCursorDictCMySQLCursorNamedTupleCMySQLCursorPreparedCMySQLCursorPreparedDictCMySQLCursorPreparedNamedTupleCMySQLCursorPreparedRawCMySQLCursorRawTz2MySQL Connector/Python C Extension not available ())OTEL_ENABLED)with_context_propagation)end_spanrecord_exception_eventc                       s  e Zd ZdZdeddf fddZdddZdd	d
Zede	fddZ
deddfddZddeddfddZedefddZejdeddfddZedee	 fddZejde	ddfddZedee	 fddZejde	ddfddZedefddZejdeddfd dZedefd!d"Zdd#d$Zdd%d&ZeZdefd'd(Zdefd)d*Zdd.ed/e	d0e	ddfd1d2Zd3eddfd4d5Zd6edee fd7d8Zedee	 fd9d:Z 		+			dd;ee	 d<ed=ee!e"  d>ee d?ee# dede$e!e ee% f fd@dAZ&	+			dd<ed=ee!e"  d>ee d?ee# dede$ee ee% f fdBdCZ'dee fdDdEZ(ddFdGZ)ddHdIZ*ddJdKZ+dLeddfdMdNZ,	dd?ee# de-fdOdPZ.dee% fdQdRZ/dSe0dede#fdTdUZ1e2dVe#dWededee3e%e-f  fdXdYZ4dVe#deddfdZd[Z5dVe#deddfd\d]Z6e2		+	+dd6ed>ee d^ed_ededee3e%e-f  fd`daZ7e7Z8								dd^ee d>ee dbee dcee9e:  ddee deee dfee	 dgee	 de:fdhdiZ;ede	fdjdkZ<ede	fdldmZ=edefdndoZ>edefdpdqZ?edefdrdsZ@dteAde3eBe0 eCe0e0f f fdudvZDddwdxZE	y	y	y		y	y	y			ddzed{edLed3ee	 d|ed}ed~edee dee dee ddfddZFdefddZGeH de	dee% fddZIdddZJddee	 ddfddZKdeLfddZMde	ddfddZNdeOfddZPdeOfddZQdededeOfddZRdVe#de	deSdedeOf
ddZTddbeddfddZU		ddeeCeef  deeCeef  ddfddZV  ZWS )CMySQLConnectionz6Class initiating a MySQL Connection using Connector/C.kwargsreturnNc                    s   t stdd| _g | _tjtjtjt	j
ddd| _t dkr7tj| js7tjdr4dnd| _d| _t   |rYz| jd	i | W dS  tyX   |    w dS )
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)selfr;   	__class__rB   Y/var/www/html/api-tag/env/lib/python3.10/site-packages/mysql/connector/connection_cext.pyrT   }   s6   

zCMySQLConnection.__init__c              
   C   sZ   t jd}|d dkrd}nd}| jd|ddd	 t jdd
 D t d dS )z!Add default connection attributes r   GPLv2zGPL-2.0
Commercialzmysql-connector-python.c                 S   s   g | ]}t |qS rB   )str).0xrB   rB   r[   
<listcomp>   s    z<CMySQLConnection._add_default_conn_attrs.<locals>.<listcomp>   )_connector_name_connector_license_connector_version_source_hostN)	r   LICENSEsplit_conn_attrsupdaterI   VERSIONsocketgethostname)rX   license_chunksclient_licenserB   rB   r[   _add_default_conn_attrs   s   z(CMySQLConnection._add_default_conn_attrsc              	   C   sT   | j  | j  | j  dddd| j  d| _| | jd | _| j	| j dS )z<Gather information of the MySQL server before authenticationN)protocolserver_version_originalserver_threadidcharsetserver_statusauth_plugin	auth_datacapabilitiesrt   )
rE   get_proto_infoget_server_info	thread_idst_server_capabilities
_handshake_check_server_version_server_version_character_setset_mysql_versionrX   rB   rB   r[   _do_handshake   s   zCMySQLConnection._do_handshakec                 C   
   | j  S )z6Returns the server status attribute of MYSQL structure)rE   st_server_statusr   rB   rB   r[   _server_status      
zCMySQLConnection._server_statusrH   c                 C   s   | j r| j | dS dS )zJset local_infile_in_path

        Set allow_local_infile_in_path.
        N)rE   !set_load_data_local_infile_option)rX   rH   rB   rB   r[   set_allow_local_infile_in_path   s   z/CMySQLConnection.set_allow_local_infile_in_pathTvaluec                 C   s2   || _ | jr| j| | jr| j| dS dS )zuToggle unicode mode

        Set whether we return string fields as unicode or not.
        Default is True.
        N)_use_unicoderE   use_unicoderR   set_unicoderX   r   rB   rB   r[   r      s   zCMySQLConnection.set_unicodec                 C   s   |  dd }|dkS )z#Get whether autocommit is on or offzSELECT @@session.autocommitr   r   
info_queryr   rB   rB   r[   
autocommit   s   zCMySQLConnection.autocommitc              
   C   sH   z| j | || _W dS  ty# } zt|j|j|jd|d}~ww )zToggle autocommitmsgerrnosqlstateN)rE   r   _autocommitr(   r   r   r   r   rX   r   errrB   rB   r[   r      s   c                 C      | j S N)_read_timeoutr   rB   rB   r[   read_timeout      zCMySQLConnection.read_timeouttimeoutc                 C      t d)Nz
            The use of read_timeout after the connection has been established is unsupported
            in the C-Extension
            r   rX   r   rB   rB   r[   r         c                 C   r   r   )_write_timeoutr   rB   rB   r[   write_timeout   r   zCMySQLConnection.write_timeoutc                 C   r   )Nz
            Changes in write_timeout after the connection has been established is unsupported
            in the C-Extension
            r   r   rB   rB   r[   r      r   c                 C   s   |  dd S )zGet the current databasezSELECT DATABASE()r   r   r   rB   rB   r[   database  s   zCMySQLConnection.databasec              
   C   B   z	| j | W dS  ty  } zt|j|j|jd|d}~ww )zSet the current databaser   NrE   	select_dbr(   r   r   r   r   r   rB   rB   r[   r     s   c                 C   s   t | jtj@ S )z'MySQL session has started a transaction)boolr   r   STATUS_IN_TRANSr   rB   rB   r[   in_transaction  s   zCMySQLConnection.in_transactionc           	      C   s  | j | jd }tj| j| j|| jpd| j| j	| j
d| _| tjs'i | _i d| jd| jd| jd| jd| jd| jd	| jd
| jd| jd| jd| jddd| jd| jd| jd| jd| jt| j t!rvt"| j n| j | j#| j$r| j$nd| j%r| j%ndd}| j&'d}|d ur|j(dd d)|}| j&'dd ur| j&'dd pd }| j&'dd }nd }d }|d urd|v r|sd}| j*s|+| j&'d| j&'d| j&'d|||| j&'d pd!| j&'d"pd!| j*d#	 t,j-d$kr| j.d%krd|d&< z| jj/d)i | | j0| j_1| j2r| j0| j2_3W n t4y8 } zt5|j6|j7|j8d'|d }~ww | 9  | j*sjt:| jd(rlt;| jj<rn| j< }t=| j&'dg D ]}t>| t?|| q]d S d S d S d S )*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   get_ssl_cipherrB   )@r   get_info_charset_idrL   MySQL	_buffered_raw_connection_timeoutr   _auth_pluginrN   rE   isset_client_flagr   CONNECT_ARGSrk   _host_user	_password
_password1
_password2
_password3	_database_port_client_flags_unix_socket	_compress_allow_local_infile_allow_local_infile_in_path_oci_config_file_oci_config_profile
isinstance_webauthn_callbackr`   r%   _openid_token_filer   r   _sslgetsortrI   _ssl_disabledrl   rG   name_auth_plugin_classrU   _converter_str_fallbackconverter_str_fallbackrR   str_fallbackr(   r   r   r   r   r   hasattrcallabler   setr'   r&   )	rX   r   
cnx_kwargsr   ssl_ciphersuitesr   r   ciphertls_versionrB   rB   r[   _open_connection  s   
	











	
z!CMySQLConnection._open_connectionc              
   C   s   | j r| j  rt| j t d  | jsdS z7z|   | j  W n tyB } zt	r3t| j | t
|j|j|jd|d}~ww W t	rMt| j  dS dS t	rWt| j  w w )z Disconnect from the MySQL serverr   Nr   )_spanis_recordingr9   sysexc_inforE   free_resultrW   r(   r6   r   r   r   r   r8   )rX   r   rB   rB   r[   rW     s.   zCMySQLConnection.closec                 C   s   | j   S )z8Return True if the connection to MySQL Server is closed.)rE   	connectedr   rB   rB   r[   	is_closed     zCMySQLConnection.is_closedc                 C   s   | j r|   | j  S dS )z;Reports whether the connection to MySQL Server is availableF)rE   handle_unread_resultpingr   rB   rB   r[   is_connected  s   
zCMySQLConnection.is_connectedFr   r   	reconnectattemptsdelayc                 C   sP   |    z| j }W n	 ty   Y nw |rdS |r$| j||d dS td)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  rE   r  AttributeErrorr  r   )rX   r  r  r  r  rB   rB   r[   r    s   zCMySQLConnection.pingrv   c                 C   s   | j | dS )z;Sets the default character set name for current connection.N)rE   set_character_set)rX   rv   rB   rB   r[   set_character_set_name  s   z'CMySQLConnection.set_character_set_namequeryc              
   C   s~   d}z%| j | | j jr | j  }| j  r | j   td| j   W |S  ty> } zt|j|j	|j
d|d}~ww )z%Send a query which only returns 1 rowrB   z'Query should not return more than 1 rowr   N)rE   r  have_result_set	fetch_rowr
  r   r(   r   r   r   r   )rX   r  	first_rowr   rB   rB   r[   r     s$   


zCMySQLConnection.info_queryc                 C   s"   z| j  W S  ty   Y dS w )zMySQL connection IDN)rE   r}   r(   r   rB   rB   r[   connection_id  s   zCMySQLConnection.connection_idcountbinarycolumnsr   	prep_stmtc              
   K   s  |r|j n| j}| jr|std|du r| j}g }|dur&|dkr&tdd}	z|r.|jn| jj}
| js7|r=| jd |
 }|rt	|}| j sg|sgt
| jD ]\}}|d tjkrft|| ||< qR| js| jrt
|D ]\}}|s| j| j| || ||< qq|t| |	d7 }	|r|	|krn|
 }|sB|s| |d }|r|  d| _n|   nd}W ||fS W ||fS W ||fS  ty } z|r|  tt|||   t|j|j|jd	|d}~ww )
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  unread_resultrE   r   r   r  r  rR   r   list	enumeraterF   r   VECTORr   _vector_to_python	to_pythonappendtuplefetch_eof_columnsr
  _unread_resultr(   r   r`   r   r   r   r   )rX   r  r  r  r   r  r;   r!  rowscounterr  rowidsc__eofr   rB   rB   r[   get_rows  st   





zCMySQLConnection.get_rowsc                 K   sJ   z| j d||||d\}}|r|d |fW S d|fW S  ty$   Y dS w )z.Get the next rows returned by the MySQL serverr   )r  r  r  r   r  r   NNN)r2  
IndexError)rX   r  r  r   r  r;   r+  r   rB   rB   r[   get_row9  s   	

zCMySQLConnection.get_rowc                 C   s   | j r| j   | j  S dS )zReads the next resultN)rE   consume_resultnext_resultr   rB   rB   r[   r7  Q  s   

zCMySQLConnection.next_resultc                 C   s   | j r
| j   dS dS )zFrees the resultN)rE   r
  r   rB   rB   r[   r
  X  s   zCMySQLConnection.free_resultc                 C   s    | j r|   | j   dS dS )zCommit current transactionN)rE   r  commitr   rB   rB   r[   r8  ]  s   zCMySQLConnection.commitc                 C   s"   | j r| j   | j   dS dS )zRollback current transactionN)rE   r6  rollbackr   rB   rB   r[   r9  c  s   
zCMySQLConnection.rollbackr   c              
   C   r   )zChange the current databaser   Nr   )rX   r   r   rB   rB   r[   cmd_init_dbi  s   zCMySQLConnection.cmd_init_dbc                 C   s   |r|j n| jj }|std|r| n| j }g | _|D ]'}| j|d t|d ddddt|d  tj@ t|d t|d f	 q| j	| j
 d| jdS )	z Fetch EOF and column informationNo result set      N	      )status_flagwarning_count)r   r  )r  rE   r   fetch_fieldsrF   r'  intr   NOT_NULLr   st_warning_count)rX   r  r  fieldscolrB   rB   r[   r)  r  s0   


z"CMySQLConnection.fetch_eof_columnsc                 C   s4   | j r| j  | j  | j  | j  | jdS dS )z Fetch EOF and status information)rA  field_count	insert_idaffected_rowsrw   N)rE   rE  st_field_countrI  rJ  r   r   rB   rB   r[   fetch_eof_status  s   z!CMySQLConnection.fetch_eof_status	statementc              
   K   sT   | j stdz| j |}| j|_t|W S  ty) } ztt||d}~ww )zPrepares the SQL statementMySQL Connection not availableN)	rE   r   stmt_preparer   r   r   r(   r   r`   )rX   rM  r;   stmtr   rB   rB   r[   cmd_stmt_prepare  s   
z!CMySQLConnection.cmd_stmt_preparestatement_idargsc              
   O   sh   z|j |d| ji W n ty } ztt||d}~ww g | _|js,d| _|  S d| _| 	|S )zExecutes the prepared statementquery_attrsNFT)
stmt_executerT  r(   r   r`   rF   r  r*  rL  r)  )rX   rR  rS  r;   r   rB   rB   r[   cmd_stmt_execute  s   
z!CMySQLConnection.cmd_stmt_executec              
   K   sL   | j rtdz|  W dS  ty% } zt|j|j|jd|d}~ww )zCloses the prepared statementUnread result foundr   r   N)r*  r   
stmt_closer(   r   r   r   r   rX   rR  r;   r   rB   rB   r[   cmd_stmt_close  s   zCMySQLConnection.cmd_stmt_closec              
   K   sD   | j rtdz|  W dS  ty! } ztt||d}~ww )zResets the prepared statementrW  N)r*  r   
stmt_resetr(   r   r`   rZ  rB   rB   r[   cmd_stmt_reset  s   zCMySQLConnection.cmd_stmt_resetr   raw_as_stringc              
   K   s   |    |d u r| j}zt|ts|d}| jj||||| jd W n: ty: } zt	|j
|j|jd|d }~w ty] } z| jrG| jn| j d| j }td|dfd|d }~ww g | _| jjsi|  S |  S )Nzutf-8)r   r   r^  rT  rX  :i  zConnection not available.)r   values)r  r   r   bytesencoderE   r  rT  r(   r   r   r   r   r  r   r   r   r   rF   r  rL  r)  )rX   r  r   r   r^  r;   r   addrrB   rB   r[   	cmd_query  sD   	


zCMySQLConnection.cmd_querypreparedcursor_class
dictionarynamed_tupler   r   c	           
         s2  |  | |  std|s|rtjdtd |dur)t|ts%td|| S |p-| j	}|p2| j
}d|du r=dO |du rEd	O |du rMd
O |du rUdO |du r]dO ttttttttttttd}	zt|	 jd |	 | W S  ty   d tdd fddtdD  dw )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 dictionary or named tuple.

        Dictionary and namedtuple 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
        :param named_tuple: Rows are returned as named tuple
        :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      r<  r=     )r   r   rk  rd   r<     r=  r>  rl           )cursor_name)r   r   rg  rh  re  z*Cursor not available with given criteria: z, c                    s$   g | ]}d |> @ dkr | qS )r   r   rB   )ra   r.  rS  cursor_typerB   r[   rc   l  s   $ z+CMySQLConnection.cursor.<locals>.<listcomp>rm  )r  r  r   warningswarnWarning
issubclassr)   r   r   r   r*   r4   r-   r.   r+   r/   r,   r0   r3   r1   r2   r   __name__KeyError
ValueErrorrI   range)
rX   r   r   re  rf  rg  rh  r   r   typesrB   rr  r[   cursor  sn   
'


zCMySQLConnection.cursorc                 C   s   | j jstd| j  S )z,Returns number of rows of current result setr;  )rE   r  r   num_rowsr   rB   rB   r[   r~  o  s   
zCMySQLConnection.num_rowsc                 C   s   | j sdS | j  S )zReturns number of warningsr   )rE   rA  r   rB   rB   r[   rA  w  s   
zCMySQLConnection.warning_countc                 C   s   | j sdS | j jS )z"Check if a result set is availableF)rE   r  r   rB   rB   r[   result_set_available  s   z%CMySQLConnection.result_set_availablec                 C   r   )z)Check if there are unread results or rows)r  r   rB   rB   r[   r!    s   zCMySQLConnection.unread_resultc                 C   r   )zCheck if there are more results)rE   more_resultsr   rB   rB   r[   r    r   zCMySQLConnection.more_resultsparamsc                    s   g }t |ttfr jr fdd|D }|S  jj| }|S t |tr_i } jrH| D ]\}} j j	 j
| j|| < q-|S | D ]\}} j|d || < qL|S tdt|j d| d)zPrepare parameters for statements

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

        Returns dict.
        c              	      s,   g | ]} j  j  j | jqS rB   )rR   quoteescapeto_mysql	_sql_mode)ra   r   r   rB   r[   rc     s    z6CMySQLConnection.prepare_for_mysql.<locals>.<listcomp>r   zCould not process parameters: (z)), it must be of type list, tuple or dict)r   r"  r(  rR   rE   convert_to_mysqldictitemsr  r  r  r  rb  r   typerx  )rX   r  resultr   r   rB   r   r[   prepare_for_mysql  s2   


z"CMySQLConnection.prepare_for_mysqlc                 C   s   | j   dS )zlConsume the current result

        This method consume the result by reading (consuming) all rows.
        N)rE   r6  r   rB   rB   r[   consume_results  s   z CMySQLConnection.consume_results usernamer   r   r   r   r   r   r   c                 C   s   z| j ||||||||	|
	 W n ty' } zt|j|j|jd|d}~ww |dur@t|ts5t	d|dk r=t	d|| _
|| _|   dS )z!Change the current logged in userr   Nzcharset must be an integerr   z2charset should be either zero or a postive integer)rE   change_userr(   r   r   r   r   r   rC  rz  r   r   _post_connection)rX   r  r   r   rv   r   r   r   r   r   r   r   rB   rB   r[   cmd_change_user  s8   
z CMySQLConnection.cmd_change_userc                 C   s   | j  }|r|   |S )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
        )rE   reset_connectionr  )rX   resrB   rB   r[   cmd_reset_connection  s   
z%CMySQLConnection.cmd_reset_connectionoptionsc              
   C   sN   z|    | j| W |  S  ty& } zt|j|j|jd|d }~ww )Nr   )	r  rE   refreshr(   r   r   r   r   rL  )rX   r  r   rB   rB   r[   cmd_refresh  s   zCMySQLConnection.cmd_refreshc                 C   s   |    dS )z,Close the current connection with the serverN)rW   r   rB   rB   r[   cmd_quit  r  zCMySQLConnection.cmd_quitshutdown_typec              
   C   s|   | j std|rt|std|}ntj}z| j | W n ty7 } zt|j	|j
|jd|d}~ww |   dS )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.
        rN  zInvalid shutdown typer   N)rE   r   r   r   r   SHUTDOWN_DEFAULTshutdownr(   r   r   r   r   rW   )rX   r  levelr   rB   rB   r[   cmd_shutdown  s$   
zCMySQLConnection.cmd_shutdownc              
   C   sX   |    z| j }t j|ddW S  ttfy+ } zt|j|j	|j
d|d}~ww )z'Return statistics from the MySQL serverF)with_headerr   N)r  rE   statr   parse_statisticsr(   r   r   r   r   r   )rX   r  r   rB   rB   r[   cmd_statistics#  s   
zCMySQLConnection.cmd_statistics	mysql_pidc                 C   s&   t |ts	td| d|  dS )zKill a MySQL processzMySQL PID must be intzKILL N)r   rC  rz  rd  )rX   r  rB   rB   r[   cmd_process_kill/  s   
z!CMySQLConnection.cmd_process_killc                 C      t )zSend the DEBUG commandNotImplementedErrorr   rB   rB   r[   	cmd_debug5     zCMySQLConnection.cmd_debugc                 C   r  )zSend the PING commandr  r   rB   rB   r[   cmd_ping9  r  zCMySQLConnection.cmd_ping
statementsc                 K   r  )z/Send one or more statements to the MySQL serverr  )rX   r  r;   rB   rB   r[   cmd_query_iter=  r  zCMySQLConnection.cmd_query_iterparam_iddatac                 K   r  )zSend data for a columnr  )rX   rR  r  r  r;   rB   rB   r[   cmd_stmt_send_long_dataA  s   z(CMySQLConnection.cmd_stmt_send_long_datac                 C   s6   |du r| j n| j}| jr|   dS |rtddS )z'Check whether there is an unread resultTrW  N)r*  r!  can_consume_resultsr  r   )rX   re  r!  rB   rB   r[   r  K  s   z%CMySQLConnection.handle_unread_resultuser_variablessession_variablesc                 C   s   |   std|  s2z| | j| j| j| j| j| j	| j
| j| j	 W n ty1   |   Y nw |s6|rl|  }|rP| D ]\}}|d| d|f q@|rf| D ]\}}|d| d|f qV|  dS dS )a  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.
        ri  zSET @`z` = %szSET SESSION `N)r  r   r  r  r   r   r   r   r   r   r   r   r   r   r  r}  r  executerW   )rX   r  r  curr   r   rB   rB   r[   reset_sessionS  s8   zCMySQLConnection.reset_session)r<   N)T)Fr   r   )NFNNN)FNNNr   )NFF)NNNNNNNN)
r  r  r  Nr  r  r  NNN)Fr3  )Xrx  
__module____qualname____doc__r   rT   rr   r   propertyrC  r   r`   r   r   r   r   setterr   r   r   r   r   r  rW   
disconnectr  r  r  r  r$   r"   r   r  r   r    r   r	   r   r2  r5  r7  r
  r8  r9  r:  r   r)  rL  ra  rQ  r7   r   rV  r[  r]  rd  _execute_queryr
   r)   r}  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  r  r  __classcell__rB   rB   rY   r[   r:   z   s   
!
	
	

l

T






#


(
	

`

+		

+



r:   )Or  rG   rO   rn   r  rt  typingr   r   r   r   r   r   r   r	   r
   r   r  r   _decoratingr   	abstractsr   r   	constantsr   r   r   r   r   r   
conversionr   errorsr   r   r   r   r   rs   r   r|  r   r   r    r!   r"   r#   r$   utilsr%   r&   r'   rC   rL   r(   cursor_cextr)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   ImportErrorexcopentelemetry.constantsr6   !opentelemetry.context_propagationr7   opentelemetry.instrumentationr8   r9   r:   rB   rB   rB   r[   <module>   sF   0 $	8
