
    gi,                    x    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  G d
 d          ZdS )z>
Objects to return information about a PostgreSQL connection.
    )annotations)Path)tzinfo   )errors)pq)
get_tzinfo)make_conninfoc                     e Zd ZdZdZd&dZed'd            Zed'd	            Zed'd
            Zed(d            Z	ed'd            Z
ed'd            Zed'd            Zed'd            Zd)dZed'd            Zed*d            Zed+d            Zed,d            Zd-dZed(d            Zed(d            Zed'd            Zed.d!            Zed'd"            Zd/d$Zd%S )0ConnectionInfoz1Allow access to information about the connection.psycopgpgconnpq.abc.PGconnc                    || _         d S N)r   )selfr   s     h/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/psycopg/_connection_info.py__init__zConnectionInfo.__init__   s        returnstrc                    dS )z7A string representing the database vendor connected to.
PostgreSQL r   s    r   vendorzConnectionInfo.vendor   s	     |r   c                ,    |                      d          S )zBThe server host name of the active connection. See :pq:`PQhost()`.host_get_pgconn_attrr   s    r   r   zConnectionInfo.host        $$V,,,r   c                ,    |                      d          S )z@The server IP address of the connection. See :pq:`PQhostaddr()`.hostaddrr   r   s    r   r#   zConnectionInfo.hostaddr$        $$Z000r   intc                    |                      d          x}rt          |          S t          j                                        x}rt          |          S t          j        d          )z6The port of the active connection. See :pq:`PQport()`.portz!couldn't find the connection port)r    r%   r   miscget_compiled_porteInternalError)r   r'   s     r   r'   zConnectionInfo.port)   se     ((0004 	t99
 W..000T 	t99oABBBr   c                ,    |                      d          S )z6The database name of the connection. See :pq:`PQdb()`.dbr   r   s    r   dbnamezConnectionInfo.dbname7   s     $$T***r   c                ,    |                      d          S )z4The user name of the connection. See :pq:`PQuser()`.userr   r   s    r   r0   zConnectionInfo.user<   r!   r   c                ,    |                      d          S )z3The password of the connection. See :pq:`PQpass()`.passwordr   r   s    r   r2   zConnectionInfo.passwordA   r$   r   c                ,    |                      d          S )zi
        The command-line options passed in the connection request.
        See :pq:`PQoptions`.
        optionsr   r   s    r   r4   zConnectionInfo.optionsF   s     $$Y///r   dict[str, str]c                2   | j         d t          j                                        D                                 dd           t          t          j                    dz                                            d<   fd| j	        j
        D             S )a\  Return the connection parameters values.

        Return all the parameters set to a non-default value, which might come
        either from the connection string and parameters passed to
        `~Connection.connect()` or from environment variables. The password
        is never returned (you can read it using the `password` attribute).
        c                6    i | ]}|j         	|j        |j         S r   )compiledkeyword).0is     r   
<dictcomp>z1ConnectionInfo.get_parameters.<locals>.<dictcomp>Y   s0     
 
 
z% Iqz%%%r   s   channel_bindings   preferz.pgpasss   passfilec                    i | ]j}|j         a|j        dk    rV|j                             |j                  k    7|j                                      |j                                       kS )Ns   password)valr9   getdecode)r:   r;   defaultspyencs     r   r<   z1ConnectionInfo.get_parameters.<locals>.<dictcomp>b   su     
 
 
u 	[((ai0000	 IU##QU\\%%8%8 100r   )encodingr   Conninfoget_defaults
setdefaultr   r   homeencoder   info)r   rA   rB   s    @@r   get_parameterszConnectionInfo.get_parametersN   s     
 
[--//
 
 
 	.	::: #DIKK)$; < < C C E E
 
 
 
 
[%
 
 
 	
r   c                >    t          di |                                 S )a  Return the connection string to connect to the database.

        The string contains all the parameters set to a non-default value,
        which might come either from the connection string and parameters
        passed to `~Connection.connect()` or from environment variables. The
        password is never returned (you can read it using the `password`
        attribute).
        r   )r
   rJ   r   s    r   dsnzConnectionInfo.dsnj   s$     55t2244555r   pq.ConnStatusc                >    t          j        | j        j                  S )z3The status of the connection. See :pq:`PQstatus()`.)r   
ConnStatusr   statusr   s    r   rP   zConnectionInfo.statusv   s     }T[/000r   pq.TransactionStatusc                >    t          j        | j        j                  S )zl
        The current in-transaction status of the session.
        See :pq:`PQtransactionStatus()`.
        )r   TransactionStatusr   transaction_statusr   s    r   rT   z!ConnectionInfo.transaction_status{   s     #DK$BCCCr   pq.PipelineStatusc                >    t          j        | j        j                  S )zb
        The current pipeline status of the client.
        See :pq:`PQpipelineStatus()`.
        )r   PipelineStatusr   pipeline_statusr   s    r   rX   zConnectionInfo.pipeline_status   s      !<===r   
param_name
str | Nonec                    | j                             |                    | j                            }||                    | j                  ndS )zs
        Return a parameter setting of the connection.

        Return `None` is the parameter is unknown.
        N)r   parameter_statusrH   rC   r@   )r   rY   ress      r   r\   zConnectionInfo.parameter_status   sF     k**:+<+<T]+K+KLL,/Oszz$-(((Er   c                    | j         j        S )zZ
        An integer representing the server version. See :pq:`PQserverVersion()`.
        )r   server_versionr   s    r   r_   zConnectionInfo.server_version   s    
 {))r   c                    | j         j        S )zy
        The process ID (PID) of the backend process handling this connection.
        See :pq:`PQbackendPID()`.
        )r   backend_pidr   s    r   ra   zConnectionInfo.backend_pid   s     {&&r   c                ,    |                      d          S )z
        The error message most recently generated by an operation on the connection.
        See :pq:`PQerrorMessage()`.
        error_messager   r   s    r   rc   zConnectionInfo.error_message   s     $$_555r   r   c                *    t          | j                  S )z6The Python timezone info of the connection's timezone.)r	   r   r   s    r   timezonezConnectionInfo.timezone   s     $+&&&r   c                    | j         j        S )z:The Python codec name of the connection's client encoding.)r   	_encodingr   s    r   rC   zConnectionInfo.encoding   s     {$$r   namec                `    t          | j        |          }|                    | j                  S r   )getattrr   r@   rC   )r   rh   values      r   r    zConnectionInfo._get_pgconn_attr   s'    t{D11||DM***r   N)r   r   )r   r   )r   r%   )r   r5   )r   rM   )r   rQ   )r   rU   )rY   r   r   rZ   )r   r   )rh   r   r   r   )__name__
__module____qualname____doc__r   propertyr   r   r#   r'   r.   r0   r2   r4   rJ   rL   rP   rT   rX   r\   r_   ra   rc   re   rC   r    r   r   r   r   r      s       ;;J       X - - - X- 1 1 1 X1 C C C XC + + + X+ - - - X- 1 1 1 X1 0 0 0 X0
 
 
 
8 	6 	6 	6 X	6 1 1 1 X1 D D D XD > > > X>F F F F * * * X* ' ' ' X' 6 6 6 X6 ' ' ' X' % % % X%+ + + + + +r   r   N)ro   
__future__r   pathlibr   datetimer    r   r*   r   _tzr	   conninfor
   r   r   r   r   <module>rw      s     # " " " " "                               # # # # # #e+ e+ e+ e+ e+ e+ e+ e+ e+ e+r   