Home Explore Blog CI



postgresql

87th chunk of `doc/src/sgml/ecpg.sgml`
76a661b06b98ab9ee13050b709cb533a5ba1900558f615890000000100000fba
 <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 class="parameter">descriptor_header_item</replaceable></term>
      <listitem>
       <para>
        A token identifying which header information item to set.
        Only <literal>COUNT</literal>, to set the number of descriptor
        items, is currently supported.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sql-set-descriptor-number">
      <term><replaceable class="parameter">number</replaceable></term>
      <listitem>
       <para>
        The number of the descriptor item to set.  The count starts at
        1.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sql-set-descriptor-descriptor-item">
      <term><replaceable class="parameter">descriptor_item</replaceable></term>
      <listitem>
       <para>
        A token identifying which item of information to set in the
        descriptor.  See <xref linkend="ecpg-named-descriptors"/> for a
        list of supported items.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sql-set-descriptor-value">
      <term><replaceable class="parameter">value</replaceable></term>
      <listitem>
       <para>
        A value to store into the descriptor item.  This can be an SQL
        constant or a host variable.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </refsect1>

   <refsect1>
    <title>Examples</title>
<programlisting>
EXEC SQL SET DESCRIPTOR indesc COUNT = 1;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = 2;
EXEC SQL SET DESCRIPTOR indesc VALUE 1 DATA = :val1;
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val1, DATA = 'some string';
EXEC SQL SET DESCRIPTOR indesc VALUE 2 INDICATOR = :val2null, DATA = :val2;
</programlisting>
   </refsect1>

   <refsect1>
    <title>Compatibility</title>

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

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

    <simplelist type="inline">
     <member><xref linkend="ecpg-sql-allocate-descriptor"/></member>
     <member><xref linkend="ecpg-sql-get-descriptor"/></member>
    </simplelist>
   </refsect1>
  </refentry>

  <refentry id="ecpg-sql-type">
   <refnamediv>
    <refname>TYPE</refname>
    <refpurpose>define a new data type</refpurpose>
   </refnamediv>

   <refsynopsisdiv>
<synopsis>
TYPE <replaceable class="parameter">type_name</replaceable> IS <replaceable class="parameter">ctype</replaceable>
</synopsis>
   </refsynopsisdiv>

   <refsect1>
    <title>Description</title>

    <para>
     The <command>TYPE</command> command defines a new C type.  It is
     equivalent to putting a <literal>typedef</literal> into a declare
     section.
    </para>

    <para>
     This command is only recognized when <command>ecpg</command> is
     run with the <option>-c</option> option.
    </para>
   </refsect1>

   <refsect1>
    <title>Parameters</title>

    <variablelist>
     <varlistentry id="ecpg-sql-type-type-name">

Title: ECPG SET DESCRIPTOR Parameters, Examples, and TYPE Command
Summary
This section elaborates on the parameters for the `SET DESCRIPTOR` command, including `descriptor_name`, `descriptor_header_item` (specifically `COUNT`), `number` for the descriptor item index, `descriptor_item` for information type, and `value` for storage. It provides practical examples of how to use the command. Additionally, the `TYPE` command is introduced, which defines a new C type, equivalent to a `typedef` within a declare section, and is only recognized when `ecpg` is run with the `-c` option.