#2 Invalid fetch of INT64 fields

closed
nobody
None
5
2002-04-05
2002-03-22
Anonymous
No

When INT64 field (eg. numeric) value is less than 0,
sign is not returned.
More, if value is less than 0.1, left zeroes in
fractional part are not returned.

Patch is attached.

Discussion

  • Logged In: NO

    I forgot path itself:

    --- ../DBD-InterBase-0.28.4/dbdimp.c Wed Aug 1 05:11:58 2001
    +++ dbdimp.c Fri Mar 22 12:35:59 2002
    @@ -1326,6 +1326,7 @@
    {
    ISC_INT64 q;
    char buf[25];
    + char fmt[12];
    q = *((ISC_INT64 *) (var->sqldata));
    /*
    * %Ld is a GNUism and is not portable.
    @@ -1341,8 +1342,9 @@
    * to IEEE float, which is the whole reason
    * for InterBase support of INT64.
    */
    - sprintf(buf, "%Ld.%Ld",
    - (ISC_INT64) (q / (int)
    + sprintf(fmt, "%s%%Ld.%%0%iLd", (q < 0) ?
    "-" : "", -var->sqlsca
    + sprintf(buf, fmt,
    + (ISC_INT64) abs (q / (int)
    pow(10.0, (double) -var->sqlscale)),
    (ISC_INT64) abs((q % (int)
    pow(10.0, (double) -var->sqlscale))));

     
  • Logged In: NO

    I forgot path itself:

    --- ../DBD-InterBase-0.28.4/dbdimp.c Wed Aug 1 05:11:58 2001
    +++ dbdimp.c Fri Mar 22 12:35:59 2002
    @@ -1326,6 +1326,7 @@
    {
    ISC_INT64 q;
    char buf[25];
    + char fmt[12];
    q = *((ISC_INT64 *) (var->sqldata));
    /*
    * %Ld is a GNUism and is not portable.
    @@ -1341,8 +1342,9 @@
    * to IEEE float, which is the whole reason
    * for InterBase support of INT64.
    */
    - sprintf(buf, "%Ld.%Ld",
    - (ISC_INT64) (q / (int)
    + sprintf(fmt, "%s%%Ld.%%0%iLd", (q < 0) ?
    "-" : "", -var->sqlsca
    + sprintf(buf, fmt,
    + (ISC_INT64) abs (q / (int)
    pow(10.0, (double) -var->sqlscale)),
    (ISC_INT64) abs((q % (int)
    pow(10.0, (double) -var->sqlscale))));

     
  • Edwin Pratomo
    Edwin Pratomo
    2002-04-05

    • status: open --> closed