Home Explore Blog CI



postgresql

99th chunk of `doc/src/sgml/ecpg.sgml`
74122cc62e5d2613213591d9f2c255289e29d4e0e523a5aa0000000100000fa0
 <literal>ECPG_INFORMIX_NUM_OVERFLOW</literal>
        is returned.
       </para>
       <para>
        Note that the ECPG implementation differs from the <productname>Informix</productname>
        implementation. <productname>Informix</productname> limits a long integer to the range from
        -2,147,483,647 to 2,147,483,647, while the limits in the ECPG
        implementation depend on the architecture (<literal>-LONG_MAX ..
        LONG_MAX</literal>).
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-rdatestr">
      <term><function>rdatestr</function></term>
      <listitem>
       <para>
        Converts a date to a C char* string.
<synopsis>
int rdatestr(date d, char *str);
</synopsis>
        The function receives two arguments, the first one is the date to
        convert (<literal>d</literal>) and the second one is a pointer to the target
        string. The output format is always <literal>yyyy-mm-dd</literal>, so you need
        to allocate at least 11 bytes (including the zero-byte terminator) for the
        string.
       </para>
       <para>
        The function returns 0 on success and a negative value in case of
        error.
       </para>
       <para>
        Note that ECPG's implementation differs from the <productname>Informix</productname>
        implementation. In <productname>Informix</productname> the format can be influenced by setting
        environment variables. In ECPG however, you cannot change the output
        format.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-rstrdate">
      <term><function>rstrdate</function></term>
      <listitem>
       <para>
        Parse the textual representation of a date.
<synopsis>
int rstrdate(char *str, date *d);
</synopsis>
        The function receives the textual representation of the date to convert
        (<literal>str</literal>) and a pointer to a variable of type date
        (<literal>d</literal>). This function does not allow you to specify a format
        mask. It uses the default format mask of <productname>Informix</productname> which is
        <literal>mm/dd/yyyy</literal>. Internally, this function is implemented by
        means of <function>rdefmtdate</function>. Therefore, <function>rstrdate</function> is
        not faster and if you have the choice you should opt for
        <function>rdefmtdate</function> which allows you to specify the format mask
        explicitly.
       </para>
       <para>
        The function returns the same values as <function>rdefmtdate</function>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-rtoday">
      <term><function>rtoday</function></term>
      <listitem>
       <para>
        Get the current date.
<synopsis>
void rtoday(date *d);
</synopsis>
        The function receives a pointer to a date variable (<literal>d</literal>)
        that it sets to the current date.
       </para>
       <para>
        Internally this function uses the <xref linkend="pgtypesdatetoday"/>
        function.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="ecpg-informix-functions-rjulmdy">
      <term><function>rjulmdy</function></term>
      <listitem>
       <para>
        Extract the values for the day, the month and the year from a variable
        of type date.
<synopsis>
int rjulmdy(date d, short mdy[3]);
</synopsis>
        The function receives the date <literal>d</literal> and a pointer to an array
        of 3 short integer values <literal>mdy</literal>. The variable name indicates
        the sequential order: <literal>mdy[0]</literal> will be set to contain the
        number of the month, <literal>mdy[1]</literal> will be set to the value of the
        day and <literal>mdy[2]</literal> will contain the year.
       </para>
       <para>
        The function always returns 0 at the moment.
       </para>
    

Title: Informix Date Conversion Functions: rdatestr, rstrdate, rtoday, rjulmdy
Summary
This section describes several Informix-compatible date conversion functions. `rdatestr` converts a date to a 'yyyy-mm-dd' formatted string (ECPG format cannot be changed like in Informix). `rstrdate` parses a date string using the default Informix 'mm/dd/yyyy' format. `rtoday` gets the current date. `rjulmdy` extracts the month, day, and year from a date into a short integer array.