관리-도구
편집 파일: protocol.cpython-38.pyc
U )�e(m � @ s� d Z ddlZddlZddlmZ ddlmZmZmZm Z m Z ddlmZm Z ddlmZ ddlmZmZ dd lmZ G d d� de�ZdS )z,Implements the MySQL Client/Server protocol � N)�Decimal� )� FieldFlag� ServerCmd� FieldType� ClientFlag�MAX_MYSQL_TABLE_COLUMNS)�errors�utils)�get_auth_plugin)�PY2� struct_unpack)� get_exceptionc @ s� e Zd ZdZdd� Zdd� ZdBdd�ZdCd d�ZdDdd�ZdEdd�Z dd� Z dd� Zdd� ZdFdd�Z dd� ZdGdd �ZdHd"d#�Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� ZdId.d/�Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� ZdJd<d=�Zd>d?� Zd@dA� ZdS )K� MySQLProtocolzRImplements MySQL client/server protocol Create and parses MySQL packets. c C s |t j@ r|r|�d�d S dS )z.Prepare database string for handshake response�utf8� )r ZCONNECT_WITH_DB�encode)�self�client_flags�database� r �m/opt/hc_python/lib64/python3.8/site-packages/../../../lib/python3.8/site-packages/mysql/connector/protocol.py�_connect_with_db- s zMySQLProtocol._connect_with_dbc C s� |sdS z"t |�|||||d�}|�� } W n< ttjfk rf } zt�d�t| ����W 5 d} ~ X Y nX |tj @ r�t | �}t�d|�| }n| d }|S )z#Prepare the authentication responser )�username�passwordr �ssl_enabledzFailed authentication: {0}Nz<B) r � auth_response� TypeErrorr �InterfaceError�ProgrammingError�format�strr �SECURE_CONNECTION�len�struct�pack) r r r r r �auth_plugin� auth_datar �authZplugin_auth_response�excZresplenr r r r �_auth_response3 s( �� zMySQLProtocol._auth_responseN�! r � @Fc C s� z|d } | p|d } W n6 t tfk rN } zt�d�|���W 5 d}~X Y nX |sXd}z|�d�}W n tk r~ |}Y nX t�djdt |�d �||||�} | | � ||||| | |�7 } | | �||�7 } |tj @ r�| | �d�d 7 } | S )z"Make a MySQL Authentication packetr'