Home Explore Blog CI



postgresql

86th chunk of `doc/src/sgml/ecpg.sgml`
3df8c2a5cd19f3c3b584c0872a4aaaa9a28abf80cb2daf980000000100000fa0
 autocommit behavior of
     the current database session.  By default, embedded SQL programs
     are <emphasis>not</emphasis> in autocommit mode,
     so <command>COMMIT</command> needs to be issued explicitly when
     desired.  This command can change the session to autocommit mode,
     where each individual statement is committed implicitly.
    </para>
   </refsect1>

   <refsect1>
    <title>Compatibility</title>

    <para>
     <command>SET AUTOCOMMIT</command> is an extension of PostgreSQL ECPG.
    </para>
   </refsect1>
  </refentry>

  <refentry id="ecpg-sql-set-connection">
   <refnamediv>
    <refname>SET CONNECTION</refname>
    <refpurpose>select a database connection</refpurpose>
   </refnamediv>

   <refsynopsisdiv>
<synopsis>
SET CONNECTION [ TO | = ] <replaceable class="parameter">connection_name</replaceable>
</synopsis>
   </refsynopsisdiv>

   <refsect1>
    <title>Description</title>

    <para>
     <command>SET CONNECTION</command> sets the <quote>current</quote>
     database connection, which is the one that all commands use
     unless overridden.
    </para>
   </refsect1>

   <refsect1>
    <title>Parameters</title>

    <variablelist>
     <varlistentry id="ecpg-sql-set-connection-connection-name">
      <term><replaceable class="parameter">connection_name</replaceable></term>
      <listitem>
       <para>
        A database connection name established by
        the <command>CONNECT</command> command.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sql-set-connection-current">
      <term><literal>CURRENT</literal></term>
      <listitem>
       <para>
        Set the connection to the current connection (thus, nothing happens).
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </refsect1>

   <refsect1>
    <title>Examples</title>

<programlisting>
EXEC SQL SET CONNECTION TO con2;
EXEC SQL SET CONNECTION = con1;
</programlisting>
   </refsect1>

   <refsect1>
    <title>Compatibility</title>

    <para>
     <command>SET CONNECTION</command> is specified in the SQL standard.
    </para>
   </refsect1>

   <refsect1>
    <title>See Also</title>

    <simplelist type="inline">
     <member><xref linkend="ecpg-sql-connect"/></member>
     <member><xref linkend="ecpg-sql-disconnect"/></member>
    </simplelist>
   </refsect1>
  </refentry>

  <refentry id="ecpg-sql-set-descriptor">
   <refnamediv>
    <refname>SET DESCRIPTOR</refname>
    <refpurpose>set information in an SQL descriptor area</refpurpose>
   </refnamediv>

   <refsynopsisdiv>
<synopsis>
SET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> <replaceable class="parameter">descriptor_header_item</replaceable> = <replaceable>value</replaceable> [, ... ]
SET DESCRIPTOR <replaceable class="parameter">descriptor_name</replaceable> VALUE <replaceable class="parameter">number</replaceable> <replaceable class="parameter">descriptor_item</replaceable> = <replaceable>value</replaceable> [, ...]
</synopsis>
   </refsynopsisdiv>

   <refsect1>
    <title>Description</title>

    <para>
     <command>SET DESCRIPTOR</command> populates an SQL descriptor
     area with values.  The descriptor area is then typically used to
     bind parameters in a prepared query execution.
    </para>

    <para>
     This command has two forms: The first form applies to the
     descriptor <quote>header</quote>, which is independent of a
     particular datum.  The second form assigns values to particular
     datums, identified by number.
    </para>
   </refsect1>

   <refsect1>
    <title>Parameters</title>

    <variablelist>
     <varlistentry id="ecpg-sql-set-descriptor-descriptor-name">
      <term><replaceable class="parameter">descriptor_name</replaceable></term>
      <listitem>
       <para>
        A descriptor name.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sql-set-descriptor-descriptor-header-item">
      <term><replaceable

Title: ECPG SET CONNECTION & SET DESCRIPTOR: Setting Connection and Descriptor Area Information
Summary
This section describes the `SET CONNECTION` command, which designates the active database connection for subsequent commands, and its parameter `connection_name` for specifying a previously established connection. It includes examples and states its compliance with SQL standards. The `SET DESCRIPTOR` command is then introduced, outlining how to populate an SQL descriptor area with values, typically for binding parameters in prepared query executions. It details the two forms of the command: one for the descriptor header and another for assigning values to specific data identified by number.