
    +hm                         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	ej                        Z
 G d
 de      Z G d de      ZeZy)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                       e Zd Zd Zd Zy)	PGNumericc                 "    t         j                  S N)r   to_str)selfdialects     ^/var/www/html/venv/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/pypostgresql.pybind_processorzPGNumeric.bind_processor&   s           c                 <    | j                   ry t        j                  S r   )	asdecimalr   to_float)r   r   coltypes      r   result_processorzPGNumeric.result_processor)   s    >>&&&r   N)__name__
__module____qualname__r   r    r   r   r
   r
   %   s    !'r   r
   c                       e Zd Zy)PGExecutionContext_pypostgresqlN)r   r   r   r   r   r   r   r   0   s    r   r   c                       e Zd ZdZdZdZdZdZdZdZ	dZ
eZ ej                  ej                   ej$                  eej(                  ej(                  i      Zed        Zg dZej0                  d        Zd	 Zd
 Zy)PGDialect_pypostgresqlpypostgresqlTNpyformatFc                 @    ddl m} t        j                  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$   s     r   dbapizPGDialect_pypostgresql.dbapiL   s'    - 	H 	
 r   )	ErrorInterfaceErrorDatabaseError	DataErrorOperationalErrorIntegrityErrorInternalErrorProgrammingErrorNotSupportedErrorc                 \      j                   i S t         fd j                  D              S )Nc              3   b   K   | ]&  }t        j                  |      j                  |f ( y wr   )getattrr)   r   ).0namer   s     r   	<genexpr>zIPGDialect_pypostgresql.dbapi_exception_translation_map.<locals>.<genexpr>l   s/      
 TZZ&//6
s   ,/)r)   dict_DBAPI_ERROR_NAMES)r   s   `r   dbapi_exception_translation_mapz6PGDialect_pypostgresql.dbapi_exception_translation_mapg   s2    ::I 
//
 
 	
r   c                     |j                  d      }d|v rt        |d         |d<   nd|d<   |j                  |j                         g |fS )Nuser)usernameporti8  )translate_connect_argsintupdatequery)r   urloptss      r   create_connect_argsz*PGDialect_pypostgresql.create_connect_argsq   sQ    ))6):T>tF|,DLDLCIIDzr   c                     dt        |      v S )Nzconnection is closed)str)r   e
connectioncursors       r   is_disconnectz$PGDialect_pypostgresql.is_disconnectz   s    %Q//r   )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)   r:   memoized_propertyr;   rF   rL   r   r   r   r   r   4   s    F#"&!# "#( 7tiNNHNN	
H  
 

 
0r   r   N)__doc__baser   r    r   r   rX   r   rY   r
   r   r   r   r   r   r   <module>r`      sP   .  $  ! '   '	&8 	G0Y G0T !r   