Ë
    r™ãjÐ  ã                  óî   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 d	d
l
mZ ddlmZ ddlmZ er$ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd„Z G d„ de«      ZeZy)aÚ  

.. dialect:: mysql+pymysql
    :name: PyMySQL
    :dbapi: pymysql
    :connectstring: mysql+pymysql://<username>:<password>@<host>/<dbname>[?<options>]
    :url: https://pymysql.readthedocs.io/

Unicode
-------

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

.. _pymysql_ssl:

SSL Connections
------------------

The PyMySQL DBAPI accepts the same SSL arguments as that of MySQLdb,
described at :ref:`mysqldb_ssl`.   See that section for additional examples.

If the server uses an automatically-generated certificate that is self-signed
or does not match the host name (as seen from the client), it may also be
necessary to indicate ``ssl_check_hostname=false`` in PyMySQL::

    connection_uri = (
        "mysql+pymysql://scott:tiger@192.168.0.134/test"
        "?ssl_ca=/home/gord/client-ssl/ca.pem"
        "&ssl_cert=/home/gord/client-ssl/client-cert.pem"
        "&ssl_key=/home/gord/client-ssl/client-key.pem"
        "&ssl_check_hostname=false"
    )

MySQL-Python Compatibility
--------------------------

The pymysql DBAPI is a pure Python port of the MySQL-python (MySQLdb) driver,
and targets 100% compatibility.   Most behavioral notes for MySQL-python apply
to the pymysql driver as well.

é    )Úannotations)ÚAny)ÚLiteral)ÚOptional)ÚType)ÚTYPE_CHECKING)ÚUnioné   )ÚMySQLDialect_mysqldbé   )Úutil)Úlanghelpers)ÚConnectArgsType)ÚDBAPIConnection)ÚDBAPICursor)ÚDBAPIModule)ÚPoolProxiedConnection)ÚURLc                óÌ   — t        j                  | j                  «      }	 |j                  d   }|dk(  xr  |j                   xs |j                  d   duS # t
        $ r Y yw xY w)ax  Given a Connection class like pymysql.Connection, aiomysql.Connection,
    asyncmy.Connection, inspect the ping() method and determine if it
    has a "reconnect" parameter that either defaults to True, or is positional.

    a return value of True here means that when we call ``connection.ping()``,
    we **must** pass `reconnect=False`.  a return value of False means that
    we should call ``connection.ping()`` with **no arguments**.

    This routine originates from issue #10492 for pymysql, however arg
    signature mismatches in aiomysql/asyncmy tracked by issue #13306
    necessitated a more open ended function.

    r
   Ú	reconnectr   F)r   Úget_callable_argspecÚpingÚargsÚdefaultsÚ
IndexError)Úconnection_clsÚinspÚreconnect_args      úl/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/sqlalchemy/dialects/mysql/pymysql.pyÚ _connection_ping_reconnects_truer    J   sq   € ô ×+Ñ+¨N×,?Ñ,?Ó@€Dð
ØŸ	™	 !™ˆð  Ñ+ò 
Ø—‘ÐÒ> §¡¨qÑ!1¸Ð!>ð	
øô ò Ùðús   ¡A Á	A#Á"A#c                  óÌ   ‡ — e Zd ZdZdZdZdd„Zej                  dd„«       Z	e
dd„«       Zej                  dd„«       Zdd„Z	 d	 	 	 	 	 dˆ fd	„Z	 	 	 	 	 	 	 	 dˆ fd
„Zdd„Zˆ xZS )ÚMySQLDialect_pymysqlÚpymysqlTNc                óB   — t        j                  t        |dd «      «      S )NÚVERSION_STRING)r   Úparse_version_stringÚgetattr)ÚselfÚdbapis     r   Úretrieve_dbapi_versionz+MySQLDialect_pymysql.retrieve_dbapi_versioni   s$   € ô
 ×(Ñ(Ü�EÐ+¨TÓ2ó
ð 	
ó    c                ó|   — 	 t        d«      j                  }|j                  | _        y# t        t
        f$ r Y yw xY w)Nzpymysql.cursorsTF)Ú
__import__ÚcursorsÚSSCursorÚ	_sscursorÚImportErrorÚAttributeError)r(   r.   s     r   Úsupports_server_side_cursorsz1MySQLDialect_pymysql.supports_server_side_cursorsr   s?   € ð	Ü Ð!2Ó3×;Ñ;ˆGØ$×-Ñ-ˆDŒNØøÜœ^Ð,ò 	Ùð	ús   ‚&) ©;º;c                ó   — t        d«      S )Nr#   )r-   )Úclss    r   Úimport_dbapiz!MySQLDialect_pymysql.import_dbapi{   s   € ä˜)Ó$Ð$r+   c                ó‚   — 	 t        d«      j                  j                  }t        |«      S # t        t
        f$ r Y yw xY w)a4  determine if pymysql has deprecated, changed the default of,
        or removed the 'reconnect' argument of connection.ping().

        See #10492 and
        https://github.com/PyMySQL/mysqlclient/discussions/651#discussioncomment-7308971
        for background.

        Revised as part of #13306

        zpymysql.connectionsT)r-   ÚconnectionsÚ
Connectionr    r1   r2   )r(   r9   s     r   Ú_send_false_to_pingz(MySQLDialect_pymysql._send_false_to_ping   sG   € ð	@Ü#Ø%óç‰kŸ*™*ð ô 4°JÓ?Ð?øô œ^Ð,ò 	Ùð	ús   ‚, ¬>½>c                ó`   — | j                   r|j                  d«       y|j                  «        y)NFT)r:   r   )r(   Údbapi_connections     r   Údo_pingzMySQLDialect_pymysql.do_ping•   s/   € Ø×#Ò#Ø×!Ñ! %Ô(ð ð ×!Ñ!Ô#àr+   c                óB   •— |€t        d¬«      }t        ‰| �	  ||¬«      S )NÚuser)Úusername)Ú_translate_args)ÚdictÚsuperÚcreate_connect_args)r(   ÚurlrA   Ú	__class__s      €r   rD   z(MySQLDialect_pymysql.create_connect_args�   s1   ø€ ð Ð"Ü"¨FÔ3ˆOÜ‰wÑ*Ø ð +ó 
ð 	
r+   c                ó°   •— t         ‰| �  |||«      ryt        || j                  j                  «      r#t        |«      j                  «       }d|v xs d|v S y)NTzalready closedzconnection was killedF)rC   Úis_disconnectÚ
isinstanceÚloaded_dbapiÚErrorÚstrÚlower)r(   ÚeÚ
connectionÚcursorÚstr_erF   s        €r   rH   z"MySQLDialect_pymysql.is_disconnect¦   s[   ø€ ô ‰7Ñ   J°Ô7ØÜ˜˜4×,Ñ,×2Ñ2Ô3Ü˜“F—L‘L“NˆEà  EÐ)ÒMÐ-DÈÐ-Mðð r+   c                óx   — t        |j                  d   t        «      r|j                  d   }|j                  d   S )Nr   )rI   r   Ú	Exception)r(   Ú	exceptions     r   Ú_extract_error_codez(MySQLDialect_pymysql._extract_error_code¶   s2   € Ü�i—n‘n QÑ'¬Ô3Ø!Ÿ™ qÑ)ˆIØ�~‰~˜aÑ Ð r+   )r)   r   Úreturnzutil.VersionInfo)rV   Úbool)rV   r   )r<   r   rV   zLiteral[True])N)rE   r   rA   zOptional[dict[str, Any]]rV   r   )rN   zDBAPIModule.ErrorrO   z7Optional[Union[PoolProxiedConnection, DBAPIConnection]]rP   zOptional[DBAPICursor]rV   rW   )rT   ÚBaseExceptionrV   r   )Ú__name__Ú
__module__Ú__qualname__ÚdriverÚsupports_statement_cacheÚdescription_encodingr*   r   Úmemoized_propertyr3   Úclassmethodr6   r:   r=   rD   rH   rU   Ú__classcell__)rF   s   @r   r"   r"   c   s½   ø„ Ø€FØ#ÐàÐó
ð ×"Ñ"òó #ðð ò%ó ð%ð ×"Ñ"ò@ó #ð@ó*ð EIð
Øð
Ø)Að
à	õ
ðàðð Lðð &ð	ð
 
õ÷ !r+   r"   N)r   z	Type[Any]rV   rW   )Ú__doc__Ú
__future__r   Útypingr   r   r   r   r   r	   Úmysqldbr   Ú r   r   Úengine.interfacesr   r   r   r   r   Ú
engine.urlr   r    r"   Údialect© r+   r   ú<module>rk      s\   ðñ)õV #å Ý Ý Ý Ý  Ý å )Ý Ý áå4Ý4Ý0Ý0Ý:Ý!ó
ô2V!Ð/ô V!ðr �r+   