kadler / db2sock-test

1 stars 0 forks source link

Negative values with decimal #37

Open kadler opened 5 years ago

kadler commented 5 years ago

Original report by Sebastian Misiewicz (Bitbucket: SMisiewicz, GitHub: sebastian-misiewicz).


Hi

There seems to be an issue when converting negative values (gt > -1 and lt < 0). Here is an example , SQL result

val.png

however when I use JSON400 query I got an error due to missing '0'

val2.png

the correct value is -0.9

val_ok.png

It might help - PaseJson.c - json_output_record_name_value

#!c

  char * fmt_key_val_zero_neg_dec = "\"%s\":-%s";

and

#!c

     } else if (value[0] == '-' && value[1] == '.') {
    value[0] = '0';
        fmt_val = fmt_val_zero_dec;
        fmt_key_val = fmt_key_val_zero_neg_dec;             
      } else {

Regards Sebastian Misiewicz