Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/ecpg-ref.sgml`
da8f8e883428d200a89c59c409acd196d39e11f1ad2218ae0000000100000e9c
    </varlistentry>

    <varlistentry>
     <term><option>-r <replaceable>option</replaceable></option></term>
     <listitem>
      <para>
       Selects run-time behavior.  <replaceable>Option</replaceable> can be
       one of the following:
       <variablelist>
        <varlistentry>
         <term><option>no_indicator</option></term>
         <listitem>
         <para>
         Do not use indicators but instead use special values to represent
         null values. Historically there have been databases using this approach.
         </para>
         </listitem>
        </varlistentry>
        <varlistentry>
         <term><option>prepare</option></term>
         <listitem>
         <para>
         Prepare all statements before using them. Libecpg will keep a cache of
         prepared statements and reuse a statement if it gets executed again. If the
         cache runs full, libecpg will free the least used statement.
         </para>
         </listitem>
        </varlistentry>
        <varlistentry>
         <term><option>questionmarks</option></term>
         <listitem>
         <para>
         Allow question mark as placeholder for compatibility reasons.
         This used to be the default long ago.
         </para>
         </listitem>
        </varlistentry>
       </variablelist></para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-t</option></term>
     <listitem>
      <para>
       Turn on autocommit of transactions. In this mode, each SQL command is
       automatically committed unless it is inside an explicit
       transaction block. In the default mode, commands are committed
       only when <command>EXEC SQL COMMIT</command> is issued.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-v</option></term>
     <listitem>
      <para>
       Print additional information including the version and the
       "include" path.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>--version</option></term>
     <listitem>
      <para>
       Print the <application>ecpg</application> version and exit.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-?</option></term>
     <term><option>--help</option></term>
     <listitem>
      <para>
       Show help about <application>ecpg</application> command line
       arguments, and exit.
      </para>
     </listitem>
    </varlistentry>

   </variablelist>
  </para>
 </refsect1>


 <refsect1>
  <title>Notes</title>

  <para>
   When compiling the preprocessed C code files, the compiler needs to
   be able to find the <application>ECPG</application> header files in the
   <productname>PostgreSQL</productname> include directory.  Therefore, you might
   have to use the <option>-I</option> option when invoking the compiler
   (e.g., <literal>-I/usr/local/pgsql/include</literal>).
  </para>

  <para>
   Programs using C code with embedded SQL have to be linked against
   the <filename>libecpg</filename> library, for example using the
   linker options <literal>-L/usr/local/pgsql/lib -lecpg</literal>.
  </para>

  <para>
   The value of either of these directories that is appropriate for
   the installation can be found out using <xref
   linkend="app-pgconfig"/>.
  </para>
 </refsect1>


 <refsect1>
  <title>Examples</title>

  <para>
   If you have an embedded SQL C source file named
   <filename>prog1.pgc</filename>, you can create an executable
   program using the following sequence of commands:
<programlisting>
ecpg prog1.pgc
cc -I/usr/local/pgsql/include -c prog1.c
cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg
</programlisting></para>
 </refsect1>

</refentry>

Title: ecpg Options and Usage Notes
Summary
This section continues the description of `ecpg` command-line options, including compatibility settings for question marks as placeholders. It also covers options for transaction autocommit, displaying version information, and accessing help. The section further provides notes on compiling preprocessed C code, linking against the `libecpg` library, and offers an example of creating an executable program from an embedded SQL C source file.