Home Explore Blog CI



postgresql

52th chunk of `doc/src/sgml/libpq.sgml`
fb30aff3ab47e0c1cbe8b54fb6fa976ee00ff545dd6c378f0000000100000fa7
 allows an application to obtain
        information about a previously created portal.
        (<application>libpq</application> does not provide any direct access to
        portals, but you can use this function to inspect the properties
        of a cursor created with a <command>DECLARE CURSOR</command> SQL command.)
       </para>

       <para>
        <parameter>portalName</parameter> can be <literal>""</literal> or <symbol>NULL</symbol> to reference
        the unnamed portal, otherwise it must be the name of an existing
        portal.  On success, a <structname>PGresult</structname> with status
        <literal>PGRES_COMMAND_OK</literal> is returned.  The functions
        <xref linkend="libpq-PQnfields"/>, <xref linkend="libpq-PQfname"/>,
        <xref linkend="libpq-PQftype"/>, etc. can be applied to the
        <structname>PGresult</structname> to obtain information about the result
        columns (if any) of the portal.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-PQclosePrepared">
      <term><function>PQclosePrepared</function><indexterm><primary>PQclosePrepared</primary></indexterm></term>

      <listitem>
       <para>
        Submits a request to close the specified prepared statement, and waits
        for completion.
<synopsis>
PGresult *PQclosePrepared(PGconn *conn, const char *stmtName);
</synopsis>
       </para>

       <para>
        <xref linkend="libpq-PQclosePrepared"/> allows an application to close
        a previously prepared statement. Closing a statement releases all
        of its associated resources on the server and allows its name to be
        reused.
       </para>

       <para>
        <parameter>stmtName</parameter> can be <literal>""</literal> or
        <symbol>NULL</symbol> to reference the unnamed statement. It is fine
        if no statement exists with this name, in that case the operation is a
        no-op. On success, a <structname>PGresult</structname> with
        status <literal>PGRES_COMMAND_OK</literal> is returned.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="libpq-PQclosePortal">
      <term><function>PQclosePortal</function><indexterm><primary>PQclosePortal</primary></indexterm></term>

      <listitem>
       <para>
        Submits a request to close the specified portal, and waits for
        completion.
<synopsis>
PGresult *PQclosePortal(PGconn *conn, const char *portalName);
</synopsis>
       </para>

       <para>
        <xref linkend="libpq-PQclosePortal"/> allows an application to trigger
        a close of a previously created portal. Closing a portal releases all
        of its associated resources on the server and allows its name to be
        reused. (<application>libpq</application> does not provide any
        direct access to portals, but you can use this function to close a
        cursor created with a <command>DECLARE CURSOR</command> SQL command.)
       </para>

       <para>
        <parameter>portalName</parameter> can be <literal>""</literal> or
        <symbol>NULL</symbol> to reference the unnamed portal. It is fine
        if no portal exists with this name, in that case the operation is a
        no-op. On success, a <structname>PGresult</structname> with status
        <literal>PGRES_COMMAND_OK</literal> is returned.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>

   <para>
    The <structname>PGresult</structname><indexterm><primary>PGresult</primary></indexterm>
    structure encapsulates the result returned by the server.
    <application>libpq</application> application programmers should be
    careful to maintain the <structname>PGresult</structname> abstraction.
    Use the accessor functions below to get at the contents of
    <structname>PGresult</structname>.  Avoid directly referencing the
    fields of the <structname>PGresult</structname> structure because they
    are subject to change in the future.

    <variablelist>

Title: PQclosePrepared and PQclosePortal: Closing Prepared Statements and Portals
Summary
This section details the functions `PQclosePrepared` and `PQclosePortal`, which allow applications to close previously created prepared statements and portals, respectively. Closing these objects releases associated server resources and enables name reuse. Both functions return a `PGresult` with status `PGRES_COMMAND_OK` upon success, and operations are no-ops if the specified statement/portal does not exist. The section then introduces the `PGresult` structure.