Home Explore Blog CI



postgresql

43th chunk of `doc/src/sgml/libpq.sgml`
02667f778cf603c536394a2cdf63ed75942f4bcfb76fef330000000100000fa7
 descriptor number of the connection socket to
       the server.  A valid descriptor will be greater than or equal
       to 0; a result of -1 indicates that no server connection is
       currently open.  (This will not change during normal operation,
       but could change during connection setup or reset.)

<synopsis>
int PQsocket(const PGconn *conn);
</synopsis>

      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="libpq-PQbackendPID">
     <term><function>PQbackendPID</function><indexterm><primary>PQbackendPID</primary></indexterm></term>
     <listitem>
      <para>
       Returns the process <acronym>ID</acronym> (PID)<indexterm>
        <primary>PID</primary>
        <secondary>determining PID of server process</secondary>
        <tertiary>in libpq</tertiary>
       </indexterm>
       of the backend process handling this connection.

<synopsis>
int PQbackendPID(const PGconn *conn);
</synopsis>
      </para>

      <para>
       The backend <acronym>PID</acronym> is useful for debugging
       purposes and for comparison to <command>NOTIFY</command>
       messages (which include the <acronym>PID</acronym> of the
       notifying backend process).  Note that the
       <acronym>PID</acronym> belongs to a process executing on the
       database server host, not the local host!
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="libpq-PQconnectionNeedsPassword">
     <term><function>PQconnectionNeedsPassword</function><indexterm><primary>PQconnectionNeedsPassword</primary></indexterm></term>
     <listitem>
      <para>
       Returns true (1) if the connection authentication method
       required a password, but none was available.
       Returns false (0) if not.

<synopsis>
int PQconnectionNeedsPassword(const PGconn *conn);
</synopsis>
      </para>

      <para>
       This function can be applied after a failed connection attempt
       to decide whether to prompt the user for a password.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="libpq-PQconnectionUsedPassword">
     <term><function>PQconnectionUsedPassword</function><indexterm><primary>PQconnectionUsedPassword</primary></indexterm></term>
     <listitem>
      <para>
       Returns true (1) if the connection authentication method
       used a password. Returns false (0) if not.

<synopsis>
int PQconnectionUsedPassword(const PGconn *conn);
</synopsis>
      </para>

      <para>
       This function can be applied after either a failed or successful
       connection attempt to detect whether the server demanded a password.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="libpq-PQconnectionUsedGSSAPI">
     <term><function>PQconnectionUsedGSSAPI</function><indexterm><primary>PQconnectionUsedGSSAPI</primary></indexterm></term>
     <listitem>
      <para>
       Returns true (1) if the connection authentication method
       used GSSAPI. Returns false (0) if not.

<synopsis>
int PQconnectionUsedGSSAPI(const PGconn *conn);
</synopsis>
      </para>

      <para>
       This function can be applied to detect whether the connection was
       authenticated with GSSAPI.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>

  <para>
    The following functions return information related to SSL. This information
    usually doesn't change after a connection is established.

    <variablelist>
    <varlistentry id="libpq-PQsslInUse">
     <term><function>PQsslInUse</function><indexterm><primary>PQsslInUse</primary></indexterm></term>
     <listitem>
      <para>
        Returns true (1) if the connection uses SSL, false (0) if not.

<synopsis>
int PQsslInUse(const PGconn *conn);
</synopsis>
      </para>

     </listitem>
    </varlistentry>

    <varlistentry id="libpq-PQsslAttribute">
     <term><function>PQsslAttribute</function><indexterm><primary>PQsslAttribute</primary></indexterm></term>
     <listitem>
      <para>
        Returns SSL-related

Title: PQbackendPID, PQconnectionNeedsPassword, PQconnectionUsedPassword, PQconnectionUsedGSSAPI, and SSL-Related Functions
Summary
This section describes several functions related to connection information and security. PQbackendPID returns the process ID of the backend process. PQconnectionNeedsPassword indicates if a password was required but not provided. PQconnectionUsedPassword indicates if a password was used for authentication. PQconnectionUsedGSSAPI indicates if GSSAPI was used. Finally, PQsslInUse indicates whether the connection uses SSL.