o
    =am                     @   sz   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 G dd	 d	ej	Z
G d
d deZG dd deZeZdS )a  
.. dialect:: postgresql+pypostgresql
    :name: py-postgresql
    :dbapi: pypostgresql
    :connectstring: postgresql+pypostgresql://user:password@host:port/dbname[?key=value&key=value...]
    :url: https://python.projects.pgfoundry.org/

.. note::

    The pypostgresql dialect is **not tested as part of SQLAlchemy's continuous
    integration** and may have unresolved issues.  The recommended PostgreSQL
    driver is psycopg2.

.. deprecated:: 1.4 The py-postgresql DBAPI is deprecated and will be removed
   in a future version. This DBAPI is superseded by the external
    version available at external-dialect_. Please use the external version or
    one of the supported DBAPIs to connect to PostgreSQL.

.. TODO update link
.. _external-dialect: https://github.com/PyGreSQL

   )	PGDialect)PGExecutionContext   )
processors)types)utilc                   @   s   e Zd Zdd Zdd ZdS )	PGNumericc                 C   s   t jS N)r   to_str)selfdialect r   a/var/www/html/gps/gps/lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/pypostgresql.pybind_processor&   s   zPGNumeric.bind_processorc                 C   s   | j rd S tjS r	   )	asdecimalr   to_float)r   r   coltyper   r   r   result_processor)   s   zPGNumeric.result_processorN)__name__
__module____qualname__r   r   r   r   r   r   r   %   s    r   c                   @   s   e Zd ZdS )PGExecutionContext_pypostgresqlN)r   r   r   r   r   r   r   r   0   s    r   c                   @   s~   e Zd ZdZdZdZdZdZdZdZ	dZ
eZeejejeejejiZedd Zg dZejd	d
 Zdd Zdd ZdS )PGDialect_pypostgresqlpypostgresqlTNpyformatFc                 C   s   ddl m} tjddd |S )N    )dbapi20zThe py-postgresql DBAPI is deprecated and will be removed in a future version. This DBAPI is superseded by the externalversion available at https://github.com/PyGreSQL. Please use one of the supported DBAPIs to connect to PostgreSQL.z1.4)version)postgresql.driverr   r   warn_deprecated)clsr   r   r   r   dbapiL   s   zPGDialect_pypostgresql.dbapi)	ErrorInterfaceErrorDatabaseError	DataErrorOperationalErrorIntegrityErrorInternalErrorProgrammingErrorNotSupportedErrorc                    s&    j d u ri S t fdd jD S )Nc                 3   s"    | ]}t  j|j|fV  qd S r	   )getattrr!   r   ).0namer   r   r   	<genexpr>l   s
    
zIPGDialect_pypostgresql.dbapi_exception_translation_map.<locals>.<genexpr>)r!   dict_DBAPI_ERROR_NAMESr.   r   r.   r   dbapi_exception_translation_mapg   s
   
z6PGDialect_pypostgresql.dbapi_exception_translation_mapc                 C   sB   |j dd}d|v rt|d |d< nd|d< ||j g |fS )Nuser)usernameporti8  )translate_connect_argsintupdatequery)r   urloptsr   r   r   create_connect_argsq   s   z*PGDialect_pypostgresql.create_connect_argsc                 C   s   dt |v S )Nzconnection is closed)str)r   e
connectioncursorr   r   r   is_disconnectz   s   z$PGDialect_pypostgresql.is_disconnect)r   r   r   driversupports_statement_cachesupports_unicode_statementssupports_unicode_bindsdescription_encodingdefault_paramstylesupports_sane_rowcountsupports_sane_multi_rowcountr   execution_ctx_clsr   update_copyr   colspecssqltypesNumericr   Floatclassmethodr!   r1   memoized_propertyr2   r<   rA   r   r   r   r   r   4   s.    	

		r   N)__doc__baser   r    r   r   rM   r   rN   r   r   r   r   r   r   r   r   <module>   s   J