Home Explore Blog CI



postgresql

48th chunk of `doc/src/sgml/ecpg.sgml`
c17cd66732676edc1cb1f0ce28444beca6055af6574d07f10000000100000fa1
 <para>
        It contains the size of the allocated space in bytes.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sqlda-sqlda-sqln">
      <term><literal>sqln</literal></term>
      <listitem>
       <para>
        It contains the number of input parameters for a parameterized query in
        case it's passed into <command>OPEN</command>, <command>DECLARE</command> or
        <command>EXECUTE</command> statements using the <literal>USING</literal>
        keyword. In case it's used as output of <command>SELECT</command>,
        <command>EXECUTE</command> or <command>FETCH</command> statements,
        its value is the same as <literal>sqld</literal>
        statement
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sqlda-sqlda-sqld">
      <term><literal>sqld</literal></term>
      <listitem>
       <para>
        It contains the number of fields in a result set.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-sqlda-sqlda-desc-next">
      <term><literal>desc_next</literal></term>
      <listitem>
       <para>
        If the query returns more than one record, multiple linked
        SQLDA structures are returned, and <literal>desc_next</literal> holds
        a pointer to the next entry in the list.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry id="ecpg-sqlda-sqlda-sqlvar">
      <term><literal>sqlvar</literal></term>
      <listitem>
       <para>
        This is the array of the columns in the result set.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
     </para>
    </sect4>

    <sect4 id="ecpg-sqlda-sqlvar">
     <title>sqlvar_t Structure</title>

     <para>
      The structure type <type>sqlvar_t</type> holds a column value
      and metadata such as type and length. The definition of the type
      is:

<programlisting>
struct sqlvar_struct
{
    short          sqltype;
    short          sqllen;
    char          *sqldata;
    short         *sqlind;
    struct sqlname sqlname;
};

typedef struct sqlvar_struct sqlvar_t;
</programlisting>

      The meaning of the fields is:

        <variablelist>
         <varlistentry id="ecpg-sqlda-sqlvar-sqltype">
         <term><literal>sqltype</literal></term>
          <listitem>
           <para>
            Contains the type identifier of the field. For values,
            see <literal>enum ECPGttype</literal> in <literal>ecpgtype.h</literal>.
           </para>
          </listitem>
         </varlistentry>

         <varlistentry id="ecpg-sqlda-sqlvar-sqllen">
         <term><literal>sqllen</literal></term>
          <listitem>
           <para>
            Contains the binary length of the field. e.g., 4 bytes for <type>ECPGt_int</type>.
           </para>
          </listitem>
         </varlistentry>

         <varlistentry id="ecpg-sqlda-sqlvar-sqldata">
         <term><literal>sqldata</literal></term>
          <listitem>
           <para>
            Points to the data.  The format of the data is described
            in <xref linkend="ecpg-variables-type-mapping"/>.
           </para>
          </listitem>
         </varlistentry>

         <varlistentry id="ecpg-sqlda-sqlvar-sqlind">
         <term><literal>sqlind</literal></term>
          <listitem>
           <para>
            Points to the null indicator.  0 means not null, -1 means
            null.
           </para>
          </listitem>
         </varlistentry>

         <varlistentry id="ecpg-sqlda-sqlvar-sqlname">
         <term><literal>sqlname</literal></term>
          <listitem>
           <para>
            The name of the field.
           </para>
          </listitem>
         </varlistentry>
        </variablelist>
     </para>
    </sect4>

    <sect4 id="ecpg-sqlda-sqlname">
     <title>struct sqlname Structure</title>

     <para>
      A <type>struct sqlname</type> structure holds a column name.  It
      is used as a member of the

Title: ECPG SQLDA Structures: sqlda_t, sqlvar_t, and sqlname Details
Summary
This section elaborates on the fields of the sqlda_t structure, including 'desc_next' which points to the next SQLDA structure in a linked list if the query returns multiple records, and 'sqlvar', which is an array representing the columns in the result set. It then transitions to the sqlvar_t structure, used for holding column values and metadata. The section defines the structure's fields such as 'sqltype', 'sqllen', 'sqldata', 'sqlind', and 'sqlname', explaining the purpose and content of each.