
    ؄_	                     N    d Z ddlmZ ddlmZ ddlmZ  G d de          ZeZdS )	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.

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.

   )MySQLDialect_mysqldb   )langhelpers)py3kc                        e Zd ZdZdZdZdZd
 fd	Zej	        d             Z
ed             Z fdZerd	 Z xZS  xZS )MySQLDialect_pymysqlpymysqlNTFc                 V     t          t          |           j        di | || _        d S )N )superr   __init__server_side_cursors)selfr   kwargs	__class__s      f/var/www/book.euthymeo.com/html/venv/lib/python3.11/site-packages/sqlalchemy/dialects/mysql/pymysql.pyr   zMySQLDialect_pymysql.__init__/   s5    2"D))2<<V<<<#6       c                 x    	 t          d          j        }|j        | _        dS # t          t
          f$ r Y dS 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_cursors3   sN    	 !233;G$-DN4^, 	 	 	55	s    $ 99c                      t          d          S )Nr	   )r   )clss    r   dbapizMySQLDialect_pymysql.dbapi<   s    )$$$r   c                     t          t          |                               |||          rdS t          || j        j                  r)t          |                                          }d|v pd|v S dS )NTzalready closedzconnection was killedF)r   r   is_disconnect
isinstancer   Errorstrlower)r   e
connectioncursorstr_er   s        r   r    z"MySQLDialect_pymysql.is_disconnect@   s}    %t,,::z6
 
 
	 44:+,, 	FFLLNNE E)M-D-M 5r   c                 v    t          |j        d         t                    r|j        d         }|j        d         S )N    )r!   args	Exception)r   	exceptions     r   _extract_error_codez(MySQLDialect_pymysql._extract_error_codeO   s4    ).+Y77 .%N1-	>!$$r   )F)__name__
__module____qualname__driverdescription_encodingsupports_unicode_statementssupports_unicode_bindsr   r   memoized_propertyr   classmethodr   r    r   r.   __classcell__)r   s   @r   r   r   $   s        F
 #'!7 7 7 7 7 7 "  #" % % [%      %	% 	% 	% 	% 	% 	% 	%% % % %r   r   N)__doc__mysqldbr   utilr   r   r   dialectr   r   r   <module>r=      s~    . * ) ) ) ) )            .% .% .% .% .%/ .% .% .%b r   