Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/mysql/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/mysql/__pycache__/mysqldb.cpython-311.pyc

�

�܋f8!����dZddlZddlmZddlmZddlmZddlmZddlmZd	d
lm	Z	d	dlm
Z
Gd�d
e��ZGd�de��ZGd�de��Z
Gd�de��ZeZdS)a

.. dialect:: mysql+mysqldb
    :name: mysqlclient (maintained fork of MySQL-Python)
    :dbapi: mysqldb
    :connectstring: mysql+mysqldb://<user>:<password>@<host>[:<port>]/<dbname>
    :url: https://pypi.org/project/mysqlclient/

Driver Status
-------------

The mysqlclient DBAPI is a maintained fork of the
`MySQL-Python <http://sourceforge.net/projects/mysql-python>`_ DBAPI
that is no longer maintained.  `mysqlclient`_ supports Python 2 and Python 3
and is very stable.

.. _mysqlclient: https://github.com/PyMySQL/mysqlclient-python

.. _mysqldb_unicode:

Unicode
-------

Please see :ref:`mysql_unicode` for current recommendations on unicode
handling.


Using MySQLdb with Google Cloud SQL
-----------------------------------

Google Cloud SQL now recommends use of the MySQLdb dialect.  Connect
using a URL like the following::

    mysql+mysqldb://root@/<dbname>?unix_socket=/cloudsql/<projectid>:<instancename>

Server Side Cursors
-------------------

The mysqldb dialect supports server-side cursors. See :ref:`mysql_ss_cursors`.

�N�)�
MySQLCompiler)�MySQLDialect)�MySQLExecutionContext)�MySQLIdentifierPreparer)�TEXT�)�sql)�utilc�$�eZdZed���ZdS)�MySQLExecutionContext_mysqldbc�H�t|d��r|jS|jjS)N�	_rowcount)�hasattrr�cursor�rowcount)�selfs �X/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/mysql/mysqldb.pyrz&MySQLExecutionContext_mysqldb.rowcount>s'���4��%�%�	(��>�!��;�'�'�N)�__name__�
__module__�__qualname__�propertyr�rrr
r
=s-������
�(�(��X�(�(�(rr
c��eZdZdS)�MySQLCompiler_mysqldbN�rrrrrrrrF��������Drrc��eZdZdS)�MySQLIdentifierPreparer_mysqldbNrrrrr r Jrrr c����eZdZdZdZdZdZdZdZe	Z
eZe
Zd�fd�	Zd�Zejjd���Zed���Z�fd	�Zd
�Zdd�Z�fd
�Zdd�Zd�Zd�Zegd���Z�fd�Z �xZ!S)�MySQLDialect_mysqldb�mysqldbT�formatFc����tt|��jdi|��||_|j�4t|jd��r|�|jj��nd|_dS)N�__version__�rrrr)	�superr"�__init__�server_side_cursors�dbapir�_parse_dbapi_versionr&�_mysql_dbapi_version)rr*�kwargs�	__class__s   �rr)zMySQLDialect_mysqldb.__init__[sv���2��"�D�)�)�2�<�<�V�<�<�<�#6�� ��z�%�'�$�*�m�*L�*L�%�
�%�%�d�j�&<�=�=�=��	
�!�!�!rc��tjd|��}|r.td�|�ddd��D����SdS)Nz(\d+)\.(\d+)(?:\.(\d+))?c3�8K�|]}|�t|��V��dS�N)�int)�.0�xs  r�	<genexpr>z<MySQLDialect_mysqldb._parse_dbapi_version.<locals>.<genexpr>gs(����K�K�A�Q�]��Q���]�]�]�]�K�Krr�r	r')�re�match�tuple�group)r�version�ms   rr,z)MySQLDialect_mysqldb._parse_dbapi_versiondsN���H�0�'�:�:���	��K�K�����A�q�)9�)9�K�K�K�K�K�K��9rc�x�	td��j}|j|_dS#tt
f$rYdSwxYw)NzMySQLdb.cursorsTF)�
__import__�cursors�SSCursor�	_sscursor�ImportError�AttributeError)rr@s  r�supports_server_side_cursorsz1MySQLDialect_mysqldb.supports_server_side_cursorsksN��	� �!2�3�3�;�G�$�-�D�N��4���^�,�	�	�	��5�5�	���s� $�9�9c� �td��S)N�MySQLdb)r?)�clss rr+zMySQLDialect_mysqldb.dbapits���)�$�$�$rc�b���tt|�������fd�}|S)Nc�������|��|���}|�B|���}|�d|z��|���dSdS)NzSET NAMES %s)�character_set_namer�execute�close)�conn�charset_namer�super_s   �r�
on_connectz3MySQLDialect_mysqldb.on_connect.<locals>.on_connect{sj����!���t�����2�2�4�4�L��'����������~��<�=�=�=���������(�'r)r(r"rQ)rrQrPr/s  @�rrQzMySQLDialect_mysqldb.on_connectxsA�����+�T�2�2�=�=�?�?��		�		�		�		�		��rc��	|�d��dS#|jj$r#}|�||d��rYd}~dS�d}~wwxYw)NFT)�pingr+�Error�
is_disconnect)r�dbapi_connection�errs   r�do_pingzMySQLDialect_mysqldb.do_ping�ss��	��!�!�%�(�(�(��4��
�z��	�	�	��!�!�#�'7��>�>�
��u�u�u�u�u������		���s��A�A�A�ANc�H�|�||��}|�	||_dSdSr2)�executemanyr)rr�	statement�
parameters�contextrs      r�do_executemanyz#MySQLDialect_mysqldb.do_executemany�s3���%�%�i��<�<���� (�G�����rc���|jdkoK|�d|j�d���d|j�d���d���}|rJt	jt	jt	jd��td�	����d
��g}ng}tt|���||��S)N)�zshow collation where �Charsetz = 'utf8mb4' and �	Collationz = 'utf8mb4_bin'z'test collated returns'�utf8mb4)�charset�utf8mb4_bin)�server_version_info�scalar�identifier_preparer�quoter
�collate�cast�literal_columnrr(r"�_check_unicode_returns)r�
connection�has_utf8mb4_bin�additional_testsr/s    �rrmz+MySQLDialect_mysqldb._check_unicode_returns�s����
�2�6
�
�
������(�.�.�y�9�9�9�9��(�.�.�{�;�;�;�;�
�
�
�	��	"����H��*�+D�E�E��Y�/�/�/���"��� ��� "���)�4�0�0�G�G��(�
�
�	
rc��|�tddd���}|jdi|��}|�|j��t	j|dt��t	j|dt��t	j|dt��t	j|dt��t	j|d	t��t	j|d
t��t	j|dt��t	j|dt��i}gd
�}|D]?}||vr9||||dd�<t	j||dd�t��||=�@|r||d<|�	d	d��}|j
�U	t|j
jdz��j
j}||jz}n#t t"f$r
d|_YnwxYw||d	<g|gS)N�db�user�passwd)�database�username�password�compress�connect_timeout�read_timeout�
write_timeout�client_flag�local_infile�use_unicoderd)�ssl_ca�ssl_key�ssl_cert�
ssl_capath�
ssl_cipher��sslrz.constants.CLIENTFr)�dict�translate_connect_args�update�queryr�coerce_kw_type�boolr3�str�getr+r?r�	constants�CLIENT�
FOUND_ROWSrDrC�supports_sane_rowcount)	r�url�_translate_args�optsr��keys�keyr|�CLIENT_FLAGSs	         r�create_connect_argsz(MySQLDialect_mysqldb.create_connect_args�s���"�"�������O�*�s�)�<�<�O�<�<�����C�I������D�*�d�3�3�3���D�"3�S�9�9�9���D�.�#�6�6�6���D�/�3�7�7�7���D�-��5�5�5���D�.�#�6�6�6�	
��D�-��6�6�6���D�)�S�1�1�1�
��L�L�L���	�	�C��d�{�{�#�C�y��C����G���#�C��Q�R�R��#�6�6�6���I���	��D��K��h�h�}�a�0�0���:�!�
4�)��J�'�*=�=� � ��F���|�6�6����"�K�0�
4�
4�
4�.3��+�+�+�
4����"-�D����D�z�s�0F2�2G
�G
c��|jdS)Nr)�args)r�	exceptions  r�_extract_error_codez(MySQLDialect_mysqldb._extract_error_code�s���~�a� � rc�z�	|jj}|��S#t$rtjd��YdSwxYw)z:Sniff out the character set in use for connection results.z�No 'character_set_name' can be detected with this MySQL-Python version; please upgrade to a recent version of MySQL-Python.  Assuming latin1.�latin1)rnrKrDr�warn)rrn�	cset_names   r�_detect_charsetz$MySQLDialect_mysqldb._detect_charset�sa��
	�#�-�@�I��9�;�;����	�	�	��I�#�
�
�
��8�8�	���s��:�:)�SERIALIZABLEzREAD UNCOMMITTEDzREAD COMMITTEDzREPEATABLE READ�
AUTOCOMMITc���|dkr|�d��dS|�d��tt|���||��dS)Nr�TF)�
autocommitr(r"�_set_isolation_level)rrn�levelr/s   �rr�z)MySQLDialect_mysqldb._set_isolation_levelsn����L� � ��!�!�$�'�'�'�'�'��!�!�%�(�(�(��&��-�-�B�B��E�
�
�
�
�
r)Fr2)"rrr�driver�supports_unicode_statementsr��supports_sane_multi_rowcount�supports_native_decimal�default_paramstyler
�execution_ctx_clsr�statement_compilerr �preparerr)r,r�langhelpers�memoized_propertyrE�classmethodr+rQrXr^rmr�r�r��set�_isolation_lookupr��
__classcell__)r/s@rr"r"Ns��������
�F�"&��!��#'� �"��!��5��.��.�H�
�
�
�
�
�
����
��'���(�'���%�%��[�%������ 	�	�	�)�)�)�)�

�
�
�
�
�<.�.�.�.�`!�!�!����$��	
�	
�	
������������rr")�__doc__r8�baserrrrr�r
rr
rr r"�dialectrrr�<module>r�sW��(�(�T
�	�	�	�������������'�'�'�'�'�'�)�)�)�)�)�)�������������������(�(�(�(�(�$9�(�(�(�	�	�	�	�	�M�	�	�	�	�	�	�	�	�&=�	�	�	�~�~�~�~�~�<�~�~�~�B���r

Hacked By AnonymousFox1.0, Coded By AnonymousFox