Home Explore Blog CI



postgresql

64th chunk of `doc/src/sgml/ecpg.sgml`
0f265520cbecc31139e4d977de6f060442817c5e129a00100000000100000fb3
 (<symbol>ECPG_TRANS</symbol>)</term>
     <listitem>
      <para>
       The <productname>PostgreSQL</productname> server signaled that
       we cannot start, commit, or rollback the transaction.
       (SQLSTATE 08007)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-connect">
     <term>-402 (<symbol>ECPG_CONNECT</symbol>)</term>
     <listitem>
      <para>
       The connection attempt to the database did not succeed.
       (SQLSTATE 08001)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-duplicate-key">
     <term>-403 (<symbol>ECPG_DUPLICATE_KEY</symbol>)</term>
     <listitem>
      <para>
       Duplicate key error, violation of unique constraint.  (SQLSTATE
       23505)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-subselect-not-one">
     <term>-404 (<symbol>ECPG_SUBSELECT_NOT_ONE</symbol>)</term>
     <listitem>
      <para>
       A result for the subquery is not single row. (SQLSTATE 21000)
      </para>
     </listitem>
    </varlistentry>

    <!-- currently not used by the code -->
<!--
    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-unrecognized">
     <term>-600 (<symbol>ECPG_WARNING_UNRECOGNIZED</symbol>)</term>
     <listitem>
      <para>
       An unrecognized warning was received from the server.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-query-ignored">
     <term>-601 (<symbol>ECPG_WARNING_QUERY_IGNORED</symbol>)</term>
     <listitem>
      <para>
       Current transaction is aborted.  Queries are ignored until the
       end of the transaction block.
      </para>
     </listitem>
    </varlistentry>
-->

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-unknown-portal">
     <term>-602 (<symbol>ECPG_WARNING_UNKNOWN_PORTAL</symbol>)</term>
     <listitem>
      <para>
       An invalid cursor name was specified. (SQLSTATE 34000)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-in-transaction">
     <term>-603 (<symbol>ECPG_WARNING_IN_TRANSACTION</symbol>)</term>
     <listitem>
      <para>
       Transaction is in progress. (SQLSTATE 25001)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-no-transaction">
     <term>-604 (<symbol>ECPG_WARNING_NO_TRANSACTION</symbol>)</term>
     <listitem>
      <para>
       There is no active (in-progress) transaction. (SQLSTATE 25P01)
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-portal-exists">
     <term>-605 (<symbol>ECPG_WARNING_PORTAL_EXISTS</symbol>)</term>
     <listitem>
      <para>
       An existing cursor name was specified. (SQLSTATE 42P03)
      </para>
     </listitem>
    </varlistentry>

   </variablelist>
  </para>
  </sect2>
 </sect1>

 <sect1 id="ecpg-preproc">
  <title>Preprocessor Directives</title>

  <para>
   Several preprocessor directives are available that modify how
   the <command>ecpg</command> preprocessor parses and processes a
   file.
  </para>

  <sect2 id="ecpg-include">
   <title>Including Files</title>

   <para>
    To include an external file into your embedded SQL program, use:
<programlisting>
EXEC SQL INCLUDE <replaceable>filename</replaceable>;
EXEC SQL INCLUDE &lt;<replaceable>filename</replaceable>&gt;;
EXEC SQL INCLUDE "<replaceable>filename</replaceable>";
</programlisting>
    The embedded SQL preprocessor will look for a file named
    <literal><replaceable>filename</replaceable>.h</literal>,
    preprocess it, and include it in the resulting C output.  Thus,
    embedded SQL statements in the included file are handled correctly.
   </para>

   <para>
    The <command>ecpg</command> preprocessor will search a file at
    several directories in following order:

    <itemizedlist>
     <listitem><simpara>current

Title: ECPG SQLCODE Values for Transaction, Connection, Subquery Errors, and Preprocessor Directives
Summary
This section details ECPG SQLCODE values related to transaction management failures (ECPG_TRANS -401), connection problems (ECPG_CONNECT -402), duplicate key violations (ECPG_DUPLICATE_KEY -403), and non-single row subquery results (ECPG_SUBSELECT_NOT_ONE -404). It also lists warning codes such as an invalid cursor name (ECPG_WARNING_UNKNOWN_PORTAL -602), transaction in progress (ECPG_WARNING_IN_TRANSACTION -603), no active transaction (ECPG_WARNING_NO_TRANSACTION -604), and existing cursor name (ECPG_WARNING_PORTAL_EXISTS -605). Furthermore, it describes the use of preprocessor directives in ECPG, specifically the `EXEC SQL INCLUDE` directive, which allows embedding external files into the SQL program.