o
    Jlii                     @   sD  U d Z ddlZddlZddlmZmZ ddlmZmZm	Z	m
Z
mZmZmZ ddlmZ ddlmZmZmZmZmZ ddl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"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ dZ,e-e.d< dZ/e-e.d< dZ0e-e.d< dZ1e-e.d< dZ2e-e.d< dZ3e-e.d< dZ4dZ5G dd dZ6dS )z,Implements the MySQL Client/Server protocol.    N)DecimalDecimalException)AnyDictListOptionalSequenceTupleUnion   )utils)PARAMETER_COUNT_AVAILABLE
ClientFlag	FieldFlag	FieldType	ServerCmd)DatabaseErrorInterfaceErrorProgrammingErrorget_exception)logger)MySQLAuthPluginget_auth_plugin)"MySQLCachingSHA2PasswordAuthPlugin)
ConnAttrsTypeDescriptionTypeEofPacketTypeHandShakeTypeOkPacketType%ParseValueFromBinaryResultPacketTypes
SocketTypeStatsPacketType
StrOrBytes!SupportedMysqlBinaryProtocolTypes
   PROTOCOL_VERSION   AUTH_SWITCH_STATUSEXCHANGE_FURTHER_STATUS	OK_STATUS   
MFA_STATUS   
ERR_STATUS-   i   @c                    @   s  e Zd ZdZededefddZededeeef fddZ	ededeeef fdd	Z
ed
edefddZededee defddZe			dndedededededee dedeeeef  deeef fddZedededdddddf
dedededee dedededee dee d
ee d ededeeeef  deeef fd!d"Zeedefdedededefd#d$Zedod%ed&ee defd'd(Zedpd*ed+edefd,d-Zed.edefd/d0Zed.edefd1d2Zed.edee fd3d4Z edqd.ed6ede!fd7d8Z"d.ede#fd9d:Z$edrd.ed<ede%fd=d>Z&	)dpd?e'd@eedAf dBedee(eee dAf  ee# f fdCdDZ)ed.edEe!deeef fdFdGZ*ed.edEe!deee+f fdHdIZ,e	Jdsd.ededeee-f fdKdLZ.ed.edMedeeee/e0j1e0j0f  f fdNdOZ2ed.edeee0j3f fdPdQZ4	5dqdRe(e! d.ededee5dAf fdSdTZ6	)	5dtd?e'dUe(e! dBededee(ee5dAf  ee# f f
dVdWZ7ed.edeeef fdXdYZ8edZedeeeef fd[d\Z9edZe/e0j1e0j0f deeef fd]d^Z:edZe/e0j3e0j;f deeef fd_d`Z<edaedbedcedefdddeZ=	f	f			J		dud*edce>e? dge>e dhedieeeee f  dedjee(eeef   dkedefdldmZ@dS )vMySQLProtocolzRImplements MySQL client/server protocol

    Create and parses MySQL packets.
    pktreturnc                 C   s    | d t ks
td| dd S )a  Parse a MySQL auth more data packet.

        Args:
            pkt: Packet representing an `auth more data` response.

        Returns:
            auth_data: Authentication method data (see [1]).

        Raises:
            InterfaceError: If packet's status tag doesn't
                match `protocol.EXCHANGE_FURTHER_STATUS`.

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_connection_phase_packets_protocol_auth_more_data.html
           z"Failed parsing AuthMoreData packet   N)r(   r   )r0    r4   h/var/www/html/tatsat2dev/dashboard-backend/venv/lib/python3.10/site-packages/mysql/connector/protocol.pyparse_auth_more_dataP   s   z"MySQLProtocol.parse_auth_more_datac                 C   sV   | d t kr
tdtj| dd dd\} }| r%| d dkr%| dd } | | fS )	aq  Parse a MySQL auth switch request packet.

        Args:
            pkt: Packet representing an `auth switch request` response.

        Returns:
            plugin_name: Name of the client authentication plugin to switch to.
            plugin_provided_data: Plugin provided data (see [1]).

        Raises:
            InterfaceError: If packet's status tag doesn't
                match `protocol.AUTH_SWITCH_STATUS`.

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/
                latest/page_protocol_connection_phase_packets_protocol_
                auth_switch_request.html
        r2   z'Failed parsing AuthSwitchRequest packetr3   N    endr   )r'   r   r   read_stringdecode)r0   plugin_namer4   r4   r5   parse_auth_switch_requestf   s   z'MySQLProtocol.parse_auth_switch_requestc                 C   sF   t | dd d\} }|tkrtdt j| dd\} }| | fS )a  Parse a MySQL auth next factor packet.

        Args:
            pkt: Packet representing an `auth next factor` response.

        Returns:
            plugin_name: Name of the client authentication plugin.
            plugin_provided_data: Initial authentication data for that
                client plugin (see [1]).

        Raises:
            InterfaceError: If packet's packet type doesn't
                match `protocol.MFA_STATUS`.

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_connection_phase_packets_protocol_auth_
                next_factor_request.html
        r2   Nr   z.Failed parsing AuthNextFactor packet (invalid)r7   r8   )r   read_intr+   r   r;   r<   )r0   statusr=   r4   r4   r5   parse_auth_next_factor   s
   z$MySQLProtocol.parse_auth_next_factor
conn_attrsc                    s    D ]} | du rd |< qt  fdd D t   t   }td|} D ]&}|tdt|7 }|| 7 }|tdt | 7 }| |  7 }q.|S )a{  Encode the connection attributes.

        Args:
            conn_attrs: Connection attributes.

        Returns:
            serialized_conn_attrs: Serialized connection attributes as per [1].

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_connection_phase_packets_protocol_handshake_response.html
        N c                 3   s$    | ]}t |t  |  V  qd S N)len).0xrB   r4   r5   	<genexpr>   s   " z0MySQLProtocol.make_conn_attrs.<locals>.<genexpr><B)sumrE   keysvaluesstructpackencode)rB   	attr_nameconn_attrs_lenconn_attrs_packetr4   rH   r5   make_conn_attrs   s"   

zMySQLProtocol.make_conn_attrsclient_flagsdatabasec                 C   s   | t j@ r|r| d S dS )a  Prepare database string for handshake response.

        Args:
            client_flags: Integer representing client capabilities flags.
            database: Initial database name for the connection.

        Returns:
            serialized_database: Serialized database name as per [1].

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_connection_phase_packets_protocol_handshake_response.html
        r7   )r   CONNECT_WITH_DBrP   )rU   rV   r4   r4   r5   connect_with_db   s   zMySQLProtocol.connect_with_dbNF	auth_datausernamepasswordauth_pluginauth_plugin_classssl_enabledplugin_configc              
   C   s   |sdt |||dfS |du ri }zt|||||d}|j| fi |}	W n ttfy< }
 ztd|
 |
d}
~
ww |	du rItd|j t|tj@ rXt	
t|	|	 n|	d }	|	|fS )a4  Prepare the first authentication response.

        Args:
            auth_data: Authorization data from initial handshake.
            username: Account's username.
            password: Account's password.
            client_flags: Integer representing client capabilities flags.
            auth_plugin: Authorization plugin name.
            auth_plugin_class: Authorization plugin class (has higher precedence
                than the authorization plugin name).
            ssl_enabled: Whether SSL is enabled or not.
            plugin_config: Custom configuration to be passed to the auth plugin
                when invoked. The parameters defined here will override the ones
                defined in the auth plugin itself.

        Returns:
            auth_response: Authorization plugin response.
            auth_strategy: Authorization plugin instance created based
                on the provided `auth_plugin` and `auth_plugin_class` parameters.

        Raises:
            InterfaceError: If authentication fails or when got a NULL auth response.
        r7   )r^   NzFailed authentication: z8Got NULL auth response while authenticating with plugin )r   r   auth_response	TypeErrorr   namebytesr   SECURE_CONNECTIONr   	int1storerE   )rY   rZ   r[   rU   r\   r]   r^   r_   auth_strategyr`   errr4   r4   r5   auth_plugin_first_response   s6   "z(MySQLProtocol.auth_plugin_first_responser   	handshakecharsetmax_allowed_packetis_change_user_requestc              
   C   s  |  }td}|
rtd td | du rtdd| ddu r)tddz|p/| d }W n ttfyH } z	td	| d
dd}~ww td| |
rb|t	dt
| dtj|7 }nd}|t	d| t
| d||||7 }tj| d |||||||d\}}||7 }|t||7 }|
r|t	d|7 }|tj@ r||  d 7 }|tj@ r|	dur|t|	7 }t||fS )a  Make a MySQL Authentication packet.

        Args:
            handshake: Initial handshake.
            username: Account's username.
            password: Account's password.
            database: Initial database name for the connection
            charset: Client charset (see [2]), only the lower 8-bits.
            client_flags: Integer representing client capabilities flags.
            max_allowed_packet: Maximum packet size.
            auth_plugin: Authorization plugin name.
            auth_plugin_class: Authorization plugin class (has higher precedence
                than the authorization plugin name).
            conn_attrs: Connection attributes.
            is_change_user_request: Whether is a `change user request` operation or not.
            ssl_enabled: Whether SSL is enabled or not.
            plugin_config: Custom configuration to be passed to the auth plugin
                when invoked. The parameters defined here will override the ones
                defined in the auth plugin itself.

        Returns:
            handshake_response: Handshake response as per [1].
            auth_strategy: Authorization plugin instance created based
                on the provided `auth_plugin` and `auth_plugin_class`.

        Raises:
            ProgrammingError: Handshake misses authentication info.

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_connection_phase_packets_protocol_handshake_response.html
            [2]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_basic_character_set.html#a_protocol_character_set
            zGot a `change user` requestzStarting authorization phaseNzGot a NULL handshakerY   z$Handshake misses authentication infor\   z-Handshake misses authentication plugin info ()z#The provided initial strategy is %srJ   sxxxxxxxxxxxxxxxxxxxxxxxz<IIH)rY   rZ   r[   rU   r\   r]   r^   r_   <Hr7   )rP   	bytearrayr   debugr   getra   KeyErrorrN   rO   rE   r   CHANGE_USERr/   rh   rX   r   PLUGIN_AUTHCONNECT_ARGSrT   rc   )ri   rZ   r[   rV   rj   rU   rk   r\   r]   rB   rl   r^   r_   
b_usernameresponse_payloadrg   fillerr`   rf   r4   r4   r5   	make_auth  sj   2




	


zMySQLProtocol.make_authc                 C   s&   t t|t| t|  d S )a  Make a SSL authentication packet (see [1]).

        Args:
            charset: Client charset (see [2]), only the lower 8-bits.
            client_flags: Integer representing client capabilities flags.
            max_allowed_packet: Maximum packet size.

        Returns:
            ssl_request_pkt: SSL connection request packet.

        References:
            [1]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_connection_phase_packets_protocol_ssl_request.html
            [2]: https://dev.mysql.com/doc/dev/mysql-server/latest/
                page_protocol_basic_character_set.html#a_protocol_character_set
        s                         )rc   r   	int4store	int2store)rj   rU   rk   r4   r4   r5   make_auth_ssl  s   zMySQLProtocol.make_auth_sslcommandargumentc                 C   s   t | }|dur||7 }|S )z(Make a MySQL packet containing a commandN)r   re   )r   r   datar4   r4   r5   make_command  s   
zMySQLProtocol.make_commandr   statement_idrowsc                 C   s   t | t | S )z0Make a MySQL packet with Fetch Statement command)r   r}   )r   r   r4   r4   r5   make_stmt_fetch  s   zMySQLProtocol.make_stmt_fetchpacketc           	   	   C   s  i }t d| dd d |d< |d tkr"td|d  dt tj| dd dd	\} |d
< t d| dd \|d< }}|d< |d< }}|d
  |d
< | dd } t|| }d}|tj	@ r|rmt
d|d nd}| d| }| |d } |d dkr|dd }|tj@ rd| vr|d
 drd| } |d< ntj| dd	\} |d< |d d|d< nd|d< || |d< ||d< |S )zParse a MySQL Handshake-packet<xxxxBr   r3   protocolz$Protocol mismatch; server version = z, client version = Nr7   r8   server_version_originalz<I8sx2sBH2sBxxxxxxxxxx   server_threadidrj   server_statusrm         r:   z5.5.8r\   utf-8mysql_native_passwordrY   capabilities)rN   unpackr%   r   r   r;   r<   intreadr   rd   minrw   
startswith)	r   res
auth_data1capabilities1capabilities2auth_data_lengthr   
auth_data2sizer4   r4   r5   parse_handshake  sR   

zMySQLProtocol.parse_handshakec              
   C   s   | d dks
t di }zTtd| dd d |d< t| dd \} |d< t| \} |d	< td
| dd \|d< |d< | dd } | r^t| \} |d< |d d|d< W |S W |S  tyq } zt d|d}~ww )zParse a MySQL OK-packetr2   r   z#Failed parsing OK packet (invalid).r   r3   field_countNaffected_rows	insert_idz<HHstatus_flagwarning_countinfo_msgr   zFailed parsing OK packet.)r   rN   r   r   read_lc_intread_lc_stringr<   
ValueError)r   	ok_packetrg   r4   r4   r5   parse_ok  s,   
zMySQLProtocol.parse_okc              
   C   sF   zt | dd d }|W S  tjtfy" } ztd|d}~ww )z=Parse a MySQL packet with the number of columns in result setr2   Nr   zFailed parsing column count)r   r   rN   errorr   r   )r   countrg   r4   r4   r5   parse_column_count  s   
z MySQLProtocol.parse_column_countr   encodingc              	   C   s   t | dd \} }t | \} }t | \} }t | \} }t | \} }t | \} }ztd| \}}}}}W n tjyH   tddw |||dddd| tj@ ||f	S )zParse a MySQL column-packetr2   Nz	<xHIBHBxxz!Failed parsing column information)	r   r   rN   r   r   r   r<   r   NOT_NULL)r   r   _rb   rj   column_typeflagsr4   r4   r5   parse_column  s6   


zMySQLProtocol.parse_columnc              
   C   s   |d dkr|  |S d}i }ztd|}W n tjy) } zt||d}~ww |d dkr6t|dks:t||d	 |d
< |d |d< |S )zParse a MySQL EOF-packetr2   r   zFailed parsing EOF packet.z<xxxBBHHNr   r&   	   r*   r      r   )r   rN   r   r   r   rE   )selfr   err_msgr   unpackedrg   r4   r4   r5   	parse_eof'  s   

zMySQLProtocol.parse_eofTwith_headerc           	      C   s  d}i }dg}d}|r| dd  d}n|  d}|D ]c}zdd | dd	D \}}W n ty> } zt||d}~ww |d
}zt|||< W q ttfy   zt|d
||< W n ty| } zt| d| dt| d|d}~ww Y qw |S )zParse the statistics packetz)Failed getting COM_STATISTICS informationrm   r2   Ns     c                 S   s   g | ]}|  qS r4   )strip)rF   vr4   r4   r5   
<listcomp>I      z2MySQLProtocol.parse_statistics.<locals>.<listcomp>   :r*   r   z (:rn   )	splitr   r   r<   intru   r   r   repr)	r   r   errmsgr   pairslblpairvalrg   r4   r4   r5   parse_statistics;  s6   


 zMySQLProtocol.parse_statisticssockversion.r   c                 C   s&  |}g }d}d}d}	 |s||kr	 ||fS |  }	|	drU|	dd g}
|  }	|	drA|
|	dd  |  }	|	ds/|
|	dd  ttd|
}n|	d dkri|	d dk ri| |	}d}nd}t|	dd }|du r|dur|| n|du r|du rt|	|d	7 }q)
zRead MySQL text result

        Reads all or given number of rows from the socket.

        Returns a tuple with 2 elements: a list with all rows and
        the EOF packet.
        Nr   Ts   r2   rm   r&      r   )	recvr   appendr   read_lc_string_listrr   joinr   r   )r   r   r   r   r   r   eofrowdatair   datasr4   r4   r5   read_text_resultX  s<   



zMySQLProtocol.read_text_resultfieldc                 C   s   |d t jkrd}d}n&|d t jkrd}d}n|d t jt jfv r'd}d}n|d t jkr2d}d}|d	 tj@ r=| }| |d
 t	
|| d| d fS )z%Parse an integer from a binary packetr   <b<hr*   <ir2   <qr   r   Nr   )r   TINYSHORTINT24LONGLONGLONGr   UNSIGNEDupperrN   r   )r   r   format_lengthr4   r4   r5   _parse_binary_integer  s   $z#MySQLProtocol._parse_binary_integerc                 C   sD   |d t jkrd}d}nd}d}| |d t|| d| d fS )z)Parse a float/double from a binary packetr   r   <dr2   z<fNr   )r   DOUBLErN   r   )r   r   r   r   r4   r4   r5   _parse_binary_float  s   $z!MySQLProtocol._parse_binary_floatutf8c                 C   s    t | \} }| t||fS )z(Parse a New Decimal from a binary packet)r   r   r   r<   )r   rj   valuer4   r4   r5   _parse_binary_new_decimal  s   z'MySQLProtocol._parse_binary_new_decimal
field_typec              	   C   s   | d }d}|dkr8t d| dd d }| d }| d }|tjtjfv r/tj|||d}nAtj|||d}n8|dkrpd}|d	krPt d
| d|d  d }tjt d| dd d | d | d | d | d | d |d}| |d d |fS )z&Parse a timestamp from a binary packetr   Nr2   rq   r   r   )yearmonthdayr      <Ir   r3      )r   r   r   hourminutesecondmicrosecond)rN   r   r   DATETIME	TIMESTAMPdatetimedate)r   r   r   r   r   r   r   mcsr4   r4   r5   _parse_binary_timestamp  s.   
z%MySQLProtocol._parse_binary_timestampc                 C   s   | d }|s| dd t  fS | d|d  }d}|dkr*td|dd d }td|dd d }|d dkr@|d9 }t j||d ||d	 |d d
}| |d d |fS )z'Parse a time value from a binary packetr   r   Nr   r   r3   r:   r   r   )dayssecondsmicrosecondsminuteshours)r   	timedeltarN   r   )r   r   r   r   r   tmpr4   r4   r5   _parse_binary_time  s$   z MySQLProtocol._parse_binary_timefieldsc           
   	   C   s  t |d d d }dd |d| D }||d }g }d}t|D ]\}}	|t|d d  d|d d > @ r?|d q#|	d tjtjtjtjtj	fv r]| 
||	\}}|| q#|	d tjtjfv ru| ||	\}}|| q#|	d tjtjfv r| ||\}}|| q#|	d tjtjtjfv r| ||	d \}}|| q#|	d tjkr| |\}}|| q#t|\}}z
||| W q# ty   || Y q#w t|S )	z(Parse values from a binary result packetr   r*   r   c                 S   s   g | ]}t |qS r4   )r   )rF   r   r4   r4   r5   r     r   z6MySQLProtocol._parse_binary_values.<locals>.<listcomp>r   Nr   )rE   	enumerater   r   r   r   r   r   r   r   r   r   FLOATr   DECIMAL
NEWDECIMALr   r   DATEr   r   TIMEr  r   r   r<   UnicodeDecodeErrortuple)
r   r  r   rj   null_bitmap_lengthnull_bitmaprM   r   posr   r4   r4   r5   _parse_binary_values  sR   $
z"MySQLProtocol._parse_binary_valuescolumnsc           
      C   s   g }d}d}d}	 |dur	 ||fS ||kr	 ||fS |  }	|	d dkr-| |	}d}n|	d dkr@d}| ||	dd |}|du rN|durN|| n|du rZ|du rZt|	|d7 }q	)zwRead MySQL binary protocol result

        Reads all or given number of binary resultset rows from the socket.
        Nr   Tr2   r&   r3   r   )r   r   r  r   r   )
r   r   r  r   rj   r   r   rM   r   r   r4   r4   r5   read_binary_result  s0   
z MySQLProtocol.read_binary_resultc              
   C   s   | d dks
t di }z5t| dd d\} |d< t| d\} |d< t| d\} |d	< | d
d } t| d\} |d< W |S  tyR } zt d|d}~ww )z'Parse a MySQL Binary Protocol OK packetr2   r   zFailed parsing Binary OK packetr3   Nr   r*   num_columns
num_paramsr   r   )r   r   r?   r   )r   ok_pktrg   r4   r4   r5   parse_binary_prepare_ok=  s   
z%MySQLProtocol.parse_binary_prepare_okr   c                 C   s   d}d}| dk r,| dkrd}t j}n?| dkrd}t j}n5| dkr&d}t j}n+d	}t j}n%d
}| dkr8d}t j}n| dkrBd}t j}n| dkrLd}t j}nt j}d}t|| ||fS )z0Prepare an integer for the MySQL binary protocolNr   ir   i r   i   r   r      r,   rJ   i  rq   l    r   z<Q)r   r   r   r   r   rN   rO   )r   r   r   r   r4   r4   r5   prepare_binary_integerO  s6   z$MySQLProtocol.prepare_binary_integerc                 C   s   t | tjr
tj}nt | tjrtj}ntdt| j	t
| j t
| j }t | tjrQ|t
| j t
| j t
| j }| jdkrQ|t| j7 }t
t|| }||fS )a  Prepare a timestamp object for the MySQL binary protocol

        This method prepares a timestamp of type datetime.datetime or
        datetime.date for sending over the MySQL binary protocol.
        A tuple is returned with the prepared value and field type
        as elements.

        Raises ValueError when the argument value is of invalid type.

        Returns a tuple.
        z2Argument must a datetime.datetime or datetime.dater   )
isinstancer   r   r   r   r  r   r   r~   r   re   r   r   r   r   r   r   r}   rE   )r   r   packedr4   r4   r5   prepare_binary_timestampq  s0   






z&MySQLProtocol.prepare_binary_timestampc           	      C   s  t | tjtjfstdtj}d}d}d}t | tjrO| jdk r#d}t| j	d\}}t|d\}}|t
t| jt
| t
| t
| 7 }| j}n|t
dt
| j t
| j t
| j 7 }| j}|rt|t
|7 }t
|| }t
t|| }||fS )a  Prepare a time object for the MySQL binary protocol

        This method prepares a time object of type datetime.timedelta or
        datetime.time for sending over the MySQL binary protocol.
        A tuple is returned with the prepared value and field type
        as elements.

        Raises ValueError when the argument value is of invalid type.

        Returns a tuple.
        z3Argument must a datetime.timedelta or datetime.timer   Nrm   r   i  <   )r  r   r   timer   r   r	  r   divmodr   r   r}   absre   r   r   r   r   r   rE   )	r   r   negativer   r  r   	remainderminssecsr4   r4   r5   prepare_binary_time  sH   



z!MySQLProtocol.prepare_binary_time	statementparamr   c                 C   s   t | t | | }|S )zMPrepare long data for prepared statements

        Returns a string.
        )r   r}   r~   )r$  r%  r   r   r4   r4   r5   prepare_stmt_send_long_data  s   z)MySQLProtocol.prepare_stmt_send_long_datar4   
parametersr   long_data_usedquery_attrsconverter_str_fallbackc	              	   C   s  d}	dgt |d d  }
g }g }d}t |}g }|s|n|t }|dkr'd}|du r-i }|rJt|}|D ]	\}}|| q5dgt |d d  }
|sO|r|t |krYtd	t|D ]-\}}d}|du r|
|d   d|d > O  < |ttj	t|  q]||v r|| d rtj
}ntj}nt|tr| |\}}}|| nt|tr||}|tt ||  tj}nt|tr|tt ||  tj}nt|tr|tt t||t||  tj}net|tr|td
| tj}nRt|tjtjfr"| |\}}|| n;t|tjtjfr9| |\}}|| n$|rSt||}|tt ||  tj}n
td|j j! d|t|t|  |r|d |kr|||  d |}|tt ||  q]t"|t| t"|	 }|dur|t | }n|}|r|dur|t|7 }|d#dd |
D td 7 }d}|D ]$}||7 }|dur|d |kr||||  7 }n|d7 }|d7 }q|D ]}||7 }q|S )z6Make a MySQL packet with the Statement Execute commandr   r   r   r   rm   utf8mb4r   NzTFailed executing prepared statement: data values does not match number of parametersr   z&MySQL binary protocol can not handle 'z	' objectsc                 S   s   g | ]}t d |qS )B)rN   rO   )rF   bitr4   r4   r5   r   F  s    z3MySQLProtocol.make_stmt_execute.<locals>.<listcomp>r7   )$rE   r   listr   r   r  r   re   r   NULLBLOBSTRINGr  r   r  strrP   lc_intrc   r   r  floatrN   rO   r   r   r   r  r   r  r#  r   	__class____name__r}   r   )r   r   r   r'  r   r(  rj   r)  r*  iteration_countr  rM   typesr  data_lenquery_attr_namesr   attr_valr  r   _flagsr   rb   r   parameter_countr   a_typea_valuer4   r4   r5   make_stmt_execute  s   








zMySQLProtocol.make_stmt_execute)NFNrD   )r   )r   )T)r   )r   r   )r4   r4   r   Nr   NF)Ar6  
__module____qualname____doc__staticmethodrc   r6   r	   r2  r>   rA   r   rT   r   r   rX   boolr   r   r   rh   DEFAULT_CHARSET_IDDEFAULT_MAX_ALLOWED_PACKETr   r|   r   rr   r   r   r   r   r   r   r   r   r   r   r!   r   r    r   r   r   r4  r   r   r   r
   r   r   r   r   r  r   r  r  r  r  r  r  r#  r&  r   r#   r@  r4   r4   r4   r5   r/   J   s   
	@	

u3 

)




7
%!
(
2	
r/   )7rC  r   rN   decimalr   r   typingr   r   r   r   r   r	   r
   rC   r   	constantsr   r   r   r   r   errorsr   r   r   r   r   pluginsr   r   plugins.caching_sha2_passwordr   r8  r   r   r   r   r   r   r    r!   r"   r#   r%   r   __annotations__r'   r(   r)   r+   r-   rF  rG  r/   r4   r4   r4   r5   <module>   s*   $0