
    ,h                    B   d Z ddlmZ ddlZddl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 ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ dd	lmZmZ dd
l m!Z! ddl"m#Z# ddl$m%Z%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- ddl.m/Z/ ddl0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZD ddlEmEZE ddlFmGZGmHZHmIZI ddlJmKZK ddlLmMZM ddlNmOZOmPZPmQZQmRZRmSZS ddlTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z] ddl^m_Z_m`Z`maZambZbmcZcmdZd erddl"meZe eKrddlfmgZgmhZh  G d de#      Ziy)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                  >    e Zd ZdZd7 fdZd8dZd8dZ	 	 	 	 	 	 d9	 	 	 	 	 	 	 	 	 	 	 	 	 d:dZd;dZd8dZ	d8dZ
d8d	ZeZ e       	 	 	 	 	 	 	 d<	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d=d
       Z e       	 	 	 d>	 	 	 	 	 	 	 	 	 d?d       Zd@dZedAd       ZdBdZdCdZ e       	 	 dD	 	 	 	 	 	 	 dEd       Z e       	 	 dD	 	 	 	 	 	 	 dFd       Z	 	 	 	 dG	 	 	 	 	 	 	 	 	 	 	 dHdZ e       	 	 	 	 	 dI	 	 	 	 	 	 	 	 	 	 	 	 	 dJd       Zd8dZdKdZe e       	 	 	 dL	 	 	 	 	 	 	 	 	 	 	 dMd              Z e       	 	 	 	 	 	 dNd       Z e       dOd       ZdPdZ dQdRdZ! e       dSd       Z"dTdZ#dUdZ$dVdZ% e       	 	 	 	 	 	 	 	 	 	 dW	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dXd       Z&edYd        Z'e'jP                  dZd!       Z'dAd"Z)d[d#Z*e+jX                  jP                  d\d$       Z,	 	 dD	 	 	 	 	 d]d%Z-d^d_d&Z.ed`d'       Z/	 	 	 	 	 	 	 da	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dbd(Z0d8d)Z1d8d*Z2dcd+Z3ddd,Z4ded-Z5 e       	 dQ	 	 	 	 	 dfd.       Z6	 dg	 	 	 	 	 	 	 dhd/Z7 e       	 	 	 	 	 	 did0       Z8e	 	 	 dj	 	 	 	 	 	 	 	 	 	 	 dkd1       Z9	 	 	 	 	 	 dld2Z:	 	 	 	 	 	 	 	 	 	 dmd3Z;	 	 	 	 	 	 dld4Z<dAd5Z=d8d6Z> xZ?S )nMySQLConnectionzConnection to a MySQL Serverc                   d | _         d | _        d | _        t        |           t
        | _        t        j                         | _	        d | _
        d | _        d| _        d| _        d| _        d| _        d| _        d| _        d | _        d| _        d| _        i | _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d | _        d| _         d | _!        d | _"        d | _#        d| _$        g | _%        d| _&        tO               | _(        |r	  | jR                  di | y y # tT        $ r | jW                          d | _         w xY w)	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     \/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/mysql/connector/connection.pyrZ   zMySQLConnection.__init__   sg   26.2376D","8"8":(,)-!&
  %

+/!#!"FH	!&"&#((-$$)',	%*)-!!&+/59#)-!+0#46!"2D2F&v&   

#	s   &D: :"Ec                   t               }t        j                  j                  d      }|d   dk(  rd}nd}t	        t        j                               |d   t        j                         d|dj                  t        j                  dd	 D cg c]  }t	        |       c}      |d
   d}| j                  j                  |       yc c}w )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_attrsz'MySQLConnection._add_default_conn_attrs   s    > ..s3!'&N)N		$!&)"..04-"xx19M(NAQ(NOI&
 	!35	 )Os   Cc                >   t        | j                  j                               }|d   t        k(  rt	        |      d| _        | j                  j                  |      }|d   }| j                  t        |t        t         t        f      r|nd      | _        | j                  j                  | j                         |d   t        j                   z  s| j"                  s4| j$                  dk(  rt'        d      | j$                  dk(  rt'        d	      | j(                  j+                  d
      rt'        dd      | xj,                  t        j                    z  c_        n/| j.                  s#| xj,                  t        j                   z  c_        |d   t        j0                  z  rt        j0                  g| _        |d   t        j4                  z  rd| _        t        j4                  g| _        |d   t        j8                  z  rt        j8                  g| _        || _        y)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)bytesrW   recvr;   r3   rX   rV   parse_handshake_check_server_version
isinstancer   	bytearray_server_version_character_setset_mysql_versionr   SSL	is_secureru   r,   ri   getr]   _ssl_disabledPLUGIN_AUTHclient_flagsCLIENT_QUERY_ATTRIBUTESrx   MULTI_FACTOR_AUTHENTICATION)r   packet	handshakeserver_versions       r   _do_handshakezMySQLConnection._do_handshake   s   t||((*+!9
"''NN226:	"#<=#99.3y*A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                   | j                   j                  d      s.| j                   j                  d      rJt        j                  dk(  r7|s5t	        j
                         }t        j                  d|| j                          | j                  r|| j                  k7  r| j                  }d| _	        | j                  sX|t        j                  z  rE| j                  j                  | j                  | j                   || j"                  |       d| _	        | j                  j%                  | j&                  | j(                  | j*                  | j,                  | j.                  d	       | j                  j1                  | j                  | j2                  ||| j4                  | j6                  || j"                  || j                   | j8                  |
      }| j;                  |       |t        j<                  z  s|r| j?                  |       y)ae  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) ru   
startswithr   namegetpassgetuserr4   debug
_password1rt   r   r   r   r{   	setup_sslrW   server_host_charset_idupdate_plugin_configrv   _oci_config_file_oci_config_profile_webauthn_callback_openid_token_fileauthenticaterX   
_password2
_password3_auth_plugin_class
_handle_okCONNECT_WITH_DBcmd_init_db)r   r   passwordr   r   ssl_optionsr   ok_pkts           r   _do_authzMySQLConnection._do_auth  s   & (()=>!!,,-FGGGtO(HLLF!! ??x4??: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                   d}| j                   r*t        j                  dk(  rt        | j                        }n,t        | j                  | j                  | j                        }|j                  | j                         |S )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)rf   r   r   r7   r   r6   r   server_portrj   set_connection_timeout_connection_timeout)r   conns     r   _get_connectionzMySQLConnection._get_connectionU  sm     G!3"t/?/?@D!%%%%++D 	##D$<$<=r   c                4   | j                   }| j                  }dx| _         | _        | j                  dk(  rA| j                  s5t	        | j                  | j
                        }|j                         | _        t               | _        | j                         | _
        	 | j                  j                          | j                          | j                  | j                  | j                  | j                  | j                   | j"                  | j$                         | j&                  | _        | j                   t*        j,                  z  r| j                  j/                          | j                  j1                  d       	 || _         || _        | jB                  stE        | j                  jF                  d      rjtI        | j                  jF                  jJ                        r@| j                  jF                  jK                         \  }}}tM        |       tO        ||       yyyy# t2        $ rY}| j                  j5                          t7        |t8        t:        f      r"t=        |j>                  |j@                        ||d}~ww xY w# || _         || _        w xY w)zOpen 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_timeoutru   ra   r   r   get_user_from_credentialsr>   rV   r   rW   open_connectionr   r   rb   rc   r]   ri   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_connectionz 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 !4D!5D ""))84**112 &*\\%6%6%=%=%?"FK'4(= 3 5 #!  	LL))+# 02CDE,))  I	 !4D!5Ds&   CH" "	J+AI??JJ Jc                ~    | j                   sy	 | j                   j                          y# t        t        f$ r Y yw xY w)ah  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)rW   shutdownAttributeErrorr+   r   s    r   r  zMySQLConnection.shutdown  s:     ||	LL!!#& 		s   * <<c                6   | j                   rE| j                   j                         r+t        | j                   t        j                         d          | j
                  sy 	 | j                          	 | j
                  j                          	 t        rt        | j                          d | _        y d | _        y # t        t        f$ r Y Xw xY w# t        $ r"}t        rt        | j                   |        d }~ww xY w# t        rt        | j                          w w xY w)Nr   )_spanis_recordingrP   sysexc_inforW   cmd_quitr  r+   r  r}   r8   rO   rX   )r   r  s     r   r~   zMySQLConnection.close  s    ::$**113"4::s||~a/@A||	MMO	%LL))+ $$ & 		
  	&tzz37	
 $ s6    B7 1C 7C	C		C7C22C77C: :Dc	                L   | j                          	 | j                  j                  | j                  j	                  ||xs |      |||xs | j
                         |r)| j                  j                  |xs | j                        S dS # t        $ r}	t        d      |	d}	~	ww xY w)a4  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_resultrW   sendrV   make_command_write_timeoutr   _read_timeoutr  r/   )
r   commandargumentpacket_numberr   expect_responsecompressed_packet_numberr   r   r  s
             r   	_send_cmdzMySQLConnection._send_cmd  s    6 	!!#	NLL++GV5GxH(4!4!4	 # !!,"D$2D2DE 
  	N"#CD#M	Ns   A4B	 B	 		B#BB#c                D   | j                          t        |d      st        d      d}	 |j                  |dz
        }|rB| j                  j                  ||xs | j                         |j                  |dz
        }|rB|r,	 | j                  j                  d|xs | j                         | j                  j                  |xs | j                        S # t        $ r}t        d      |d}~ww xY w# t        $ r}|d}~wt        $ r}t        d      |d}~ww xY w)	a4  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  
ValueErrorr'  rW   r  r  r  r/   r2   r   r  )r   	data_filesend_empty_packetr   r   
chunk_sizebufr  s           r   
_send_dataz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C +C7 	C4#C//C47	D DDDDc                    t        t        j                  |      | _        t        t        j                  |      | _        y)a  Handle 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_EXISTSrp   STATUS_IN_TRANSrr   )r   flagss     r   _handle_server_statusz%MySQLConnection._handle_server_status6  s.     "-Z-K-KU!S*:+E+EuMr   c                    | j                   S )z'MySQL session has started a transaction)rr   r  s    r   in_transactionzMySQLConnection.in_transaction@  s     ###r   c                    |d   t         k(  r1| j                  j                  |      }| j                  |d          |S |d   t        k(  rt        |      t        d      )a  Handle 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=   rV   parse_okr5  r;   r3   r,   )r   r   r   s      r   r   zMySQLConnection._handle_okE  s_     !9	!^^,,V4F&&vm'<=M!9
"''122r   c                    |d   t         k(  r1| j                  j                  |      }| j                  |d          |S |d   t        k(  rt        |      t        d      )a  Handle 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   r9  zExpected EOF packet)r:   rV   	parse_eofr5  r;   r3   r,   )r   r   eofs      r   _handle_eofzMySQLConnection._handle_eofV  s_     !9
"..**62C&&s='9:J!9
"''233r   c                   | j                   1t        | j                        | _         | j                   s"t        d      | j                   st        d      t        j
                  j                  |      }t        j
                  j                  | j                   j                               }t        j
                  j                  |      st        d| d      t        j
                  j                  |      st        d| d      	 t        j
                  j                  ||      st        d| d| d	      	 t        j
                  j                  |      rt        d
      | j                  s| j                  st        d      | j                  s{| j                  rot        j
                  j                  | j                        }d}	 t        j
                  j!                  ||g      }||k7  rd}	t        |	j%                  ||            	 t)        |d      }
| j+                  | j-                  |
d||            	 |
j/                          S # t        $ r}t        |d}~ww xY w# t"        $ r-}d}	t        |	j%                  t'        |      ||            |d}~ww xY w# t0        t2        f$ r Y S w xY w# t0        $ r[ 	 | j4                  j7                  d|xs | j8                         n# t:        $ r}t        d      |d}~ww xY wt        d| d      dw xY w# 	 
j/                          w # t0        t2        f$ r Y w w xY wxY w)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   r*  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*   
commonpathr+  formatr   openr   r0  r~   IOError	NameErrorrW   r  r  r  )r   filenamer   r   	file_namefile_name_from_requestr  infile_pathc_patherr_msgr,  s              r   _handle_load_data_infilez(MySQLConnection._handle_load_data_infileg  sI    ''/+Edkk+RD(//$S  -- 1  GGOOH-	!#1M1M1U1U1W!X ww~~45 12H1I J8 8  ww~~i( 1) =+ + 	*77##I/EF$	{ +##9": ;((  G 77>>)$"#HII''0P0P*  ''D,L,L''//$*J*JKKF	++[),DE $4  $GNN9k$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   2I !I( .J6 ?J!	I%I  I%(	J1(JJ!J32J36	L +K,+L,	L5LLLL ML0/M0M?MMMc                6   |rt        |      dk  rt        d      |d   t        k(  r| j                  |      S |d   t        k(  r&|dd j                         }| j                  |||      S |d   t        k(  r| j                  |      S |d   t        k(  rt        |      | j                  j                  |      }|rt        |t              st        d      dg|z  | _        t!        d|      D ]\  }| j                  j#                  | j$                  j'                  |xs | j(                        | j*                        | j                  |<   ^ | j                  | j$                  j'                  |xs | j(                              }d| _        | j                  |dS )	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 dictionary returned of:
        - columns: column information
        - eof: the EOF-packet information

        Returns a dict()
        r   Empty response   NzIllegal result setr   T)columnsr=  )lenr,   r=   r   r<   decoderX  r:   r>  r;   r3   rV   parse_column_countr   intry   rangeparse_columnrW   r   r  python_charsetunread_result)r   r   r   r   rR  column_countir=  s           r   _handle_resultz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                r    |j                  dd      }| j                  d||||      \  }}|r|d   |fS d|fS )aT  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binaryr\  rawr   r   )r   get_rows)	r   rj  r\  rk  	prep_stmtr   r   rowsr=  s	            r   get_rowzMySQLConnection.get_row  sW    " zz.$7mm% $ 
s GS>!c{r   c                   || j                   }| j                  st        d      g df}	 |j                  dd      }|rK| j                  }	|	dk(  rd}	| j
                  j                  | j                  |||	|xs | j                        }n@| j
                  j                  | j                  | j                  ||xs | j                        }|\  }}|sR|sP| j                  D|rBt        | d      r6| j                  j                  }|D cg c]  } ||| j                         }}|$| j!                  d|v r|d   n|d	          d| _        ||fS # t        $ r}
d| _        |
d}
~
ww xY wc c}w )
a  Get 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	converterr9  server_status)rq   rd  r-   r   r   rV   read_binary_resultrW   r  read_text_resultr   r+   ry   r  rs  row_to_pythonr5  )r   ri  rj  r\  rk  rm  r   rn  r   r   r  eof_prw  rows                 r   rl  zMySQLConnection.get_rows  s   $ ;))C!! 9::=?J	!::nd;L,,i'$G~~88LL 6D$6$6 ~~66LL(( 6D$6$6	 e3"".k* NN88MFJKsM#t'9'9:KDK&& E) m$?+
 "'DU{-  	!&DI	 Ls   BE E'	E$	EE$c                >    | j                   r| j                          yy)zConsume resultsN)rd  rl  r  s    r   consume_resultszMySQLConnection.consume_results_  s    MMO r   c                ~    | j                  | j                  t        j                  |j	                  d                  S )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   zMySQLConnection.cmd_init_dbd  s2     NN9,,hoog.FG
 	
r   c                   t        |t              s,t        |t              r|j                  d      }t        |      }|| _        d | _        | j                  dk7  r| j                  nd}t               }| j                  s'| j                  rt        j                  dt               | j                  t        j                  z  rcg }g }	g }
dgt        | j                        dz   dz  z  }t!        | j                  j#                               D ]2  \  }}|d	   }d}|K||dz  xx   d	|dz  z  z  cc<   |	j%                  t'        t(        j*                        t'        |      z          [t        |t,              r2| j.                  j1                  |      \  }}}|
j%                  |       n6t        |t              rI|j                  |      }|
j%                  t3        t        |            |z          t(        j4                  }nt        |t6              r8|
j%                  t3        t        |            |z          t(        j4                  }nt        |t8              rh|
j%                  t3        t        t        |      j                  |                  t        |      j                  |      z          t(        j:                  }nt        |t<              r6|
j%                  t?        j@                  d
|             t(        jB                  }nt        |tD        jD                  tD        jF                  f      r0| j.                  jI                  |      \  }}|
j%                  |       n}t        |tD        jJ                  tD        jL                  f      r0| j.                  jO                  |      \  }}|
j%                  |       n#tQ        d|jR                  jT                   d      |	j%                  t'        |      t'        |      z          |d   j                  |      }|j%                  t3        t        |            |z          5 |jW                  t3        t        | j                                     |jW                  t3        d	             |
r|jW                  djY                  |D cg c]  }t?        j@                  d|       c}      t'        d	      z          t[        |	|      D ]'  \  }}|jW                  |       |jW                  |       ) |
D ]  }|jW                  |        |jW                  |       t7        |      }	 |j]                  dd       }|j]                  dd       }| j_                  | ja                  tb        jd                  |||      ||      }|S c c}w # tP        $ r1}|jf                  dk(  rd|jh                  v rd}tk        |      | d }~ww xY w)Nr}  rq  rr  <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 disabledr@  )6r   r   r   r  rC  rB  r   rx   _query_attrswarningswarnWarningr]   r   r   r]  	enumerateitemsappendrI   r   NULLr`  rV   prepare_binary_integerrK   STRINGr   r   DECIMALfloatstructpackDOUBLEdatetimedateprepare_binary_timestamp	timedeltatimeprepare_binary_timer0   r   __name__extendr   zipr   rg  r%  r   QUERYr   r   r*   )r   queryrk  bufferedraw_as_stringr   r   r   namestypesvaluesnull_bitmappos
attr_tuplevaluer4  packed
field_typer   bit_typer   r   resultr  rW  s                             r   	cmd_queryzMySQLConnection.cmd_queryq  s    %+%%W-e$E '+$ #',,)";$,,**t/@/@MMN  
 B BBEE"$F##d&7&7"81"<!BCK#,T->->-D-D-F#G .7Z"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 ??F"MM&)(:(:HMM'JK+/>>+M+Me+T(VZMM&)*!OO445Y@  Yz2Yu5EEF!!}++G4VCI.56].7b MM&T%6%6!789 MM&)$HH{Kfkk#s3KLl# $'ue#4 (KE4MM%(MM$'( $ )EMM%() 	ef	!::nd;L"JJ=M((OO!-"/	   	F$ E L4   	yyD %E%P1  $G,#5	s   $VAV" "	W+,WWc              +    K   |j                  dd      }|j                  dd      }t               }t        |t              s,t        |t              r|j	                  d      }t        |      }| j
                  t        j                  z  r4|j                  t        d             |j                  t        d             |j                  |       t        |      }| j                  | j                  t        j                  |||      ||       | j                  r[| j!                          | j                  | j"                  j%                  |xs | j&                        ||       | j                  rZyyw)	at  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   rr  r   r   r  )r   )r   r   r   r   r  r]   r   r   r  rK   r   rg  r%  r   r  rp   r  rW   r   r  )r   
statementsr   r   r   r   r  s          r   cmd_query_iterzMySQLConnection.cmd_query_iter  s?    , zz.$7

?D9*i0*c*'..v6
":.J
 B BBMM&)$ MM&)$j!f!!NN)+	   	
 		
 $$%%'%%!!|/Qt?Q?Q!R  $$s   E3E86E8c                   |t         j                  t         j                  z  t         j                  z  t         j                  z  t         j
                  z  t         j                  z  z  st        d      d }|t         j                  z  r| j                  d      }|t         j                  z  r| j                  d      }|t         j                  z  r| j                  d      }|t         j                  z  r| j                  d      }|t         j
                  z  r| j                  d      }|t         j                  z  r"| j                  | j                  dk  rdnd	      }|S )
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REPLICAr+  r  r   )r   optionsress      r   cmd_refreshzMySQLConnection.cmd_refresh(  s5    ""#   ! ""	#
 ##$
 =>>](((..!34C]&&&...C])))..0C]'''..!OPC])))..0C]***..!%!5!5
!BC 
r   c                    | j                          | j                  j                  t        j                        }	 | j
                  j                  |dd| j                         |S # t        $ r}Y d}~|S d}~ww xY w)a  Close 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  rV   r  r   QUITrW   r  r  r2   )r   r   r  s      r   r  zMySQLConnection.cmd_quitF  sl     	!!#,,Y^^<	LLfaD,?,?@  ! 		s   (A% %	A94A9c                &    | j                  d       y)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_shutdownzMySQLConnection.cmd_shutdownX  s     	z"r   c                @   | j                          | j                  j                  t        j                        }| j
                  j                  |dd| j                         | j                  j                  | j
                  j                  | j                              S )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  rV   r  r   
STATISTICSrW   r  r  parse_statisticsr   r  r   r   s     r   cmd_statisticszMySQLConnection.cmd_statistics`  sr     	!!#,,Y-A-AB&!Q(;(;<~~..t||/@/@ASAS/TUUr   c                `    t        |t              st        d      | j                  d|       S )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   r`  r+  r  )r   	mysql_pids     r   cmd_process_killz MySQLConnection.cmd_process_killo  s0     )S)455~~i[122r   c                ^    | j                  | j                  t        j                              S )aF  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()
        )r>  r%  r   DEBUGr  s    r   	cmd_debugzMySQLConnection.cmd_debugz  s"     y ?@@r   c                ^    | j                  | j                  t        j                              S )a  Send 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_pingzMySQLConnection.cmd_ping  s      t~~inn=>>r   c                   |2t        |t              st        d      |dk  rt        d      || _        d| _        || _        || _        || _        || _        || _	        | j                  r || j                  k7  r| j                  | _        | j                          | j                  rt        d      |r|| _        |
r|
| _        |	| _        | j                   j#                  | j                  | j                  | j                  d       | j                   j%                  | j&                  | j(                  | j
                  | j                  | j                  | j                  || j                  | j*                  | j,                  | j.                  | j0                  d| j2                  | j4                  	      }| j*                  t6        j8                  z  s|r| j;                  |       | j=                          | j?                  |      S )
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   r`  r+  r   rz   ra   rb   r   r   r   r  	_compressr.   r   r   r   r{   r   r   rW   rX   r]   ru   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_userzMySQLConnection.cmd_change_user  s   . gs+ !=>>{ !UVV&D
!###??x4??:!__DN!!#>>#$STT$3D!&7D##5  	00#'#8#8&*&>&>%)%<%< 	1 	
 $$11ooZZnnoooo$$++))"55''#'++-- 2 
$ ""Z%?%??XX& v&&r   c                *    | j                  d      d   S )zGet the current databasezSELECT DATABASE()r   )
info_queryr  s    r   r   zMySQLConnection.database  s     23A66r   c                &    | j                  |       y)zSet the current databaseN)r   r   r  s     r   r   zMySQLConnection.database  s     	r   c                D    	 | j                          y# t        $ r Y yw xY w)a2  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_connectedzMySQLConnection.is_connected  s)    	MMO   		s    	c                    || _         y)zySet the path that user can upload files.

        Args:
            path (str): Path that user can upload files.
        N)rL  )r   rD  s     r   set_allow_local_infile_in_pathz.MySQLConnection.set_allow_local_infile_in_path   s     ,0(r   c                b    || _         | j                  r| j                  j                  |       y y N)rk   rs  set_unicoder  s     r   use_unicodezMySQLConnection.use_unicode  s(    !>>NN&&u- r   c                |   | j                         st        d      | j                         s	 | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  | j                  | j                  | j                  
       | j!                         }|r/|j#                         D ]  \  }}|j%                  d| d|f        |r0|j#                         D ]  \  }}|j%                  d| d|f        yy# t        $ r | j                          Y w xY w)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.
        zMySQL Connection not available.zSET @`z` = %szSET SESSION `N)r  r/   cmd_reset_connectionr  ra   rb   rc   r   r   r   r   r   r   r   r0   	reconnectcursorr  execute)r   user_variablessession_variablescurkeyr  s         r   reset_sessionzMySQLConnection.reset_session  s(   (   ""#DEE((*!$$JJNNNN$$OOOOOO)),,++ kkm,224 <
UfSE05(;</557 C
UmC57%BC  $ ! !s   A>D D;:D;c                    	 | j                          y# t        $ r,}|r| j                  ||       nt        d      |Y d}~yd}~ww xY w)a  Check availability of the MySQL server

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

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

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

        Raises InterfaceError on errors.
        )attemptsdelayz$Connection to MySQL is not availableN)r  r+   r  r,   )r   r  r  r  r  s        r   pingzMySQLConnection.ping>  sJ    	VMMO 	V>$%KLRUU ?	Vs    	A"AAc                R    | j                   r| j                   j                  d      S y)zMySQL connection IDserver_threadidN)rX   r   r  s    r   connection_idzMySQLConnection.connection_idT  s$     ????&&'899r   c                   | j                          | j                         st        d      | t        |t              r|dk  rt        d      | t        |t              r|dk  rt        d      |%t        |t              st        d       || ||      S ||n| j                  }||n| j                  }d}|du r|dz  }|du r|d	z  }|du r|d
z  }|du r|dz  }t        t        t        t        t        t        t         t"        d}		  |	|   | ||      S # t$        $ rM d}
t'        ddj)                  t+        d
      D cg c]  }|d|z  z  dk7  s|
|    nc c}w c}      z         dw xY w)aD  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   r)  )r   r   r  r   r   r[  r)     )r  rk  
dictionarypreparedz*Cursor not available with given criteria: z, )r  r  r/   r   r`  r,   
issubclassr!   r0   rn   rq   r"   r(   r$   r%   r#   r&   r'   KeyErrorr+  r   ra  )r   r  rk  r  cursor_classr  r   r   cursor_typer  argsrf  s               r   r  zMySQLConnection.cursor[  s   > 	!!#  ""#CDD#<-1A !QRR$=#.-!2C !RSS#lK8&F  !$mDD'38_c$))t1K$;1K1Kt2K "%&#'	
	&E+&lMJJ 	@D<))eAhV+a:PTU:UT!WVVWX 	s   	D )E,?EEE,c                &    | j                  d       y)zCommit current transactionCOMMITN)_execute_queryr  s    r   commitzMySQLConnection.commit  s    H%r   c                ^    | j                   r| j                          | j                  d       y)zRollback current transactionROLLBACKN)rd  rl  r  r  s    r   rollbackzMySQLConnection.rollback  s"    MMOJ'r   c                F    | j                          | j                  |       y)a  Execute 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  zMySQLConnection._execute_query  s     	!!#ur   c                    | j                  d| j                  | j                        }|j                  |       |j	                         S )z%Send a query which only returns 1 rowT)r  r   r   )r  r  r  r  fetchone)r   r  r  s      r   r  zMySQLConnection.info_query  sE    ++--  

 	u  r   c                    |d   t         k(  r| j                  j                  |      S |d   t        k(  rt	        |      t        d      )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=   rV   parse_binary_prepare_okr;   r3   r,   r  s     r   _handle_binary_okz!MySQLConnection._handle_binary_ok  sH     !9	!>>99&AA!9
"''899r   c                   |rt        |      dk  rt        d      |d   t        k(  r| j                  |      S |d   t        k(  r| j                  |      S |d   t        k(  rt        |      | j                  j                  |      }|rt        |t              st        d      dg|z  }t        d|      D ]R  }| j                  j                  | j                  j                  |xs | j                         | j"                        ||<   T | j                  | j                  j                  |xs | j                               }|||fS )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   rZ  zIllegal result set.Nr   )r]  r,   r=   r   r:   r>  r;   r3   rV   r_  r   r`  ra  rb  rW   r   r  rc  )r   r   r   re  r\  rf  r=  s          r   _handle_binary_resultz%MySQLConnection._handle_binary_result  s3   " Vq !122!9	!??6**!9
"##F++!9
"'' ~~88@:lC#@ !677*.,)>q,' 	A44!!,"D$2D2DE##GAJ	 t||001SASASTUgs++r   c                    |j                  dd      }|j                  dd      }| j                  j                  ||      }d| _        | j	                  t
        j                  |d||       d| _        y)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   rV   make_stmt_fetchrd  r%  r   
STMT_FETCH)r   statement_idrn  r   r   r   r   s          r   cmd_stmt_fetchzMySQLConnection.cmd_stmt_fetch  sr     zz.$7

?D9//dC"  !%' 	 	
 "r   c           	        |j                  dd      }|j                  dd      }| j                  t        j                  |||      }| j	                  |      }g |d<   g |d<   |d   dkD  rt        d|d         D ]a  }|d   j                  | j                  j                  | j                  j                  |xs | j                        | j                               c | j                  | j                  j                  |xs | j                               |d	   dkD  rt        d|d	         D ]a  }|d   j                  | j                  j                  | j                  j                  |xs | j                        | j                               c | j                  | j                  j                  |xs | j                               |S )
zPrepare a MySQL statement

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

        Returns a dict()
        r   Nr   r  r\  
parameters
num_paramsr   num_columns)r   r%  r   STMT_PREPAREr  ra  r  rV   rb  rW   r   r  rc  r>  )r   	statementr   r   r   r   r  r  s           r   cmd_stmt_preparez MySQLConnection.cmd_stmt_prepare  s    zz.$7

?D9""%'	   
 ''/y!|,!#1f\23 |$++NN//)),*L$:L:LM++ T\\..|/Qt?Q?QRS- 1$1f]34 y!((NN//)),*L$:L:LM++ T\\..|/Qt?Q?QRSr   c           
     \   t        |      }i }|j                  dd      }|j                  dd      }|rZt        |      D ]L  \  }	}
t        ||	   t              sd}	 d||	   j
                  v}| j                  ||	||	   ||       |f||	<   N | j                  s'| j                  rt        j                  dt               | j                  t        j                  z  rJ| j                   j#                  ||t%        |      ||| j&                  | j(                  | j*                        }n?| j                   j#                  ||t%        |      ||| j&                  | j*                  	      }| j-                  t.        j0                  |||
      }| j3                  ||      }|S # t        $ r Y =w xY w)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_datarx   r  r  r  r  r]   r   r   rV   make_stmt_executetupler   query_attrs_converter_str_fallbackr%  r   STMT_EXECUTEr  )r   r  datar  r4  r   long_data_usedr   r   param_idr  rj  execute_packetr   r  s                  r   cmd_stmt_executez MySQLConnection.cmd_stmt_executeM  s    *%
zz.$7

?D9(4 9!d8nf5!F!$DN,?,?!? 00$ X%1&3 1  17yN8,9 **t/@/@MMN  
 B BB!^^==j!  ,,	N "^^==j!'+'C'C > N ""!%'	   
 ++FLAW * s   F	F+*F+c           
         | j                  t        j                  t        |      d|j	                  dd      |j	                  dd             y)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_closezMySQLConnection.cmd_stmt_close  sE     	  l#!ND9 **_d; 	 	
r   c           
     v   d}d}	 |j                  |      }|r| j                  j                  |||      }| j                  t        j
                  |d|j                  dd      |j                  dd             |t        |      z  }|j                  |      }|r|S # t        $ r}	t        d      |	d}	~	ww xY w)	a.  Send data for a column

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

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

        cmd_stmt_send_long_data should be called before cmd_stmt_execute.

        The total bytes send is returned.

        Returns int.
        r(  r   Fr   Nr   )r   r#  r   r   r  )
r'  rV   prepare_stmt_send_long_datar%  r   STMT_SEND_LONG_DATAr   r]  r  r/   )
r   r  r(  r&  r   r.  
total_sentr/  r   r  s
             r   r   z'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 	B8'B33B8c                    | j                  | j                  t        j                  t	        |      |j                  dd      |j                  dd                   y)zReset 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_resetzMySQLConnection.cmd_stmt_reset  sN     	NN$$,'#ZZ=$jj$?	  	
r   c                    	 | j                  | j                  t        j                               | j	                          y# t
        t        f$ r Y yw xY w)zResets the session state without re-authenticating

        Reset command only works on MySQL server 5.7.3 or later.
        The result is True for a successful reset otherwise False.

        Returns bool
        TF)r   r%  r   RESET_CONNECTIONr  r.   r/   r  s    r   r  z$MySQLConnection.cmd_reset_connection  sI    	OODNN9+E+EFG!!#!#34 		s   >A AAc                l    | j                   r| j                          y| j                  rt        d      y)z'Check whether there is an unread resultzUnread result foundN)can_consume_resultsr{  rd  r-   r  s    r   r  z$MySQLConnection.handle_unread_result  s1    ##  " 566  r   )r   r   returnNone)r:  r;  )NNNr   NN)r   Optional[str]r   r<  r   r<  r   r`  r   z:Optional[Dict[str, Optional[Union[str, bool, List[str]]]]]r   zOptional[Dict[str, str]]r:  bool)r:  r5   )Nr   NTr   NN)r   r`  r!  Optional[bytes]r"  r`  r   r>  r#  r=  r$  r`  r   Optional[int]r   r?  r:  zOptional[bytearray])FNN)
r,  r   r-  r=  r   r?  r   r?  r:  r   )r4  r`  r:  r;  )r:  r=  )r   r   r:  rC   )r   r   r:  rA   )NN)rR  r   r   r?  r   r?  r:  rC   )r   r   r   r?  r   r?  r:  rD   )FNNN)rj  r=  r\  Optional[List[DescriptionType]]rk  Optional[bool]rm  Optional[CMySQLPrepStmt]r   r   r:  z1Tuple[Optional[RowType], Optional[EofPacketType]])NFNNN)ri  r?  rj  r=  r\  r@  rk  rA  rm  rB  r   r   r:  z-Tuple[List[RowType], Optional[EofPacketType]])r   r   r:  rC   )FFF)r  rG   rk  r=  r  r=  r  r=  r   r   r:  rD   )r  rG   r   r   r:  z!Generator[ResultType, None, None])r  r`  r:  rC   )r:  r   r  )r  r?  r:  r;  )r:  rF   )r  r`  r:  rC   )r:  rA   )r:  rC   )
rT   rT   rT   NrT   rT   rT   rT   rT   rT   )r   r   r   r   r   r   r   r?  r   r   r   r   r   r   r   r   r   r   r   r   r:  zOptional[OkPacketType])r:  r   )r  r   r:  r;  )rD  r   r:  r;  )r  r=  r:  r;  )r  Optional[Dict[str, Any]]r  rC  r:  r;  )Fr   r   )r  r=  r  r`  r  r`  r:  r;  )r:  r?  )NNNNNNN)r  rA  rk  rA  r  rA  r  zOptional[Type[MySQLCursor]]r  rA  r   r?  r   r?  r:  r!   )r  r   r:  r;  )r  r   r:  zOptional[RowType])r   r   r:  zDict[str, int])r   r   r   r?  r:  EUnion[OkPacketType, Tuple[int, List[DescriptionType], EofPacketType]])r   )r  r`  rn  r`  r   r   r:  r;  )r  r   r   r   r:  z/Mapping[str, Union[int, List[DescriptionType]]])rU   rU   r   )r  r`  r&  zSequence[BinaryProtocolType]r  r   r4  r`  r   r   r:  rD  )r  r`  r   r   r:  r;  )
r  r`  r(  r`  r&  r   r   r   r:  r`  )@r  
__module____qualname____doc__rZ   r   r   r   r   r  r  r~   
disconnectr   r%  r0  r5  propertyr7  r   r>  rX  rg  ro  rl  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  r  r  r  r  r*  r.  r   r5  r  r  __classcell__)r   s   @r   rR   rR      sC   &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

 
 
	
(7r   rR   )jrG  
__future__r   r  r   r   r   r  r  r  decimalr   ior   typingr   r   r   r	   r
   r   r   r   r   r   r   r   rT   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   rU   r   r   <module>r]     s   > 5 "   	   
        N 2 . ?  '	 	 	     A A 1 G 
 
 
  )Oq7- q7r   