Re: Decimal separator and 4GL_NUMERIC with postgres
Mike Aubury <[email protected]>
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <CAGAq4WHQpgsa76gDCn8G0DRJ3GW_v5tkJVWLO2EGjEDyOEvu3g@mail.gmail.com> |
I'm guessing that postgresql is getting the "," and interpreting that as a record. If theres no way in postgresql to say "use a , for the decimal separator" - which I couldnt see with a cursory google - I've added a setting "FIXUPPG8IBINDDECIMAL" which effectively defaults to "yes" - that should push the decimal across with a "." as postgresql expects. If you want to maintain the current behaviour - you can set FIXUPPG8IBINDDECIMAL=no. This should be in CVS, you can just update in "lib/libsql/postgresql" and get the new "pg8.c" - recompile and you should be good to go... On 25 January 2016 at 15:45, Alessandro Vercelli <[email protected]> wrote: > Hi again, > following the development of our application, we're facing problems while inserting numbers with comma decimal. > > Here some detail: > > Code: > > :::::::::::::: > comma_test.4gl > :::::::::::::: > DATABASE test > > GLOBALS > DEFINE > inp_data CHAR(20), > inp_code DECIMAL(10,2) > END GLOBALS > > FUNCTION insert_mytable() > INSERT into mytable VALUES (inp_data,inp_code) > END FUNCTION > > MAIN > OPEN WINDOW comma_test AT 2,1 WITH FORM "comma_test" ATTRIBUTE(PROMPT LINE FIRST, MESSAGE LINE 2, COMMENT LINE LAST) > while true > input by name inp_data,inp_code without defaults > after input > CALL insert_mytable() > end input > sleep 1 > end while > CLOSE WINDOW comma_test > END MAIN > > > :::::::::::::: > comma_test.per > :::::::::::::: > DATABASE FORMONLY > SCREEN { > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > Input [a ] [b ] > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > } > END > > ATTRIBUTES > a = FORMONLY.inp_data; > b = FORMONLY.inp_code; > END > > INSTRUCTIONS > DELIMITERS " " > END > > > Postgres table is: > > Table "public.mytable" > Column | Type | Modifiers | Storage | Description > ------------+-----------------------------+-------------+----- -------+------------- > mydata | character varying(20) | | extended | > mycode | numeric(10,2) | | main | > Has OIDs: yes > > > The error while running test program is > > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > Input abc 345,00 > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > > > Err:Program ./comma_test.4ae stopped at 'comma_test.4gl', line number 10. > Error status number -1. > column "mycode" is of type numeric but expression is of type record. > > 4gl function call stack : > comma_test.4gl (Line 18) calls insert_mytable() > MAIN > > > > Environment did not change from previous tests. > > > Thanks anyone for the help, > Alessandro > > > ---- On Fri, 18 Dec 2015 13:21:25 +0100 Alessandro Vercelli<[email protected]> wrote ---- > > > I checked enviroment again and some new tests showed a possible little bug and its workaround: > > > > $ aubit-config A4GL_NUMERIC > > ,. > > > > $ env|grep A4GL_NUMERIC > > > > $ ./formtest.4ae > > > > > > Input is 2347 > > > > xxxxxxxxxxxxxxxxxxx > > Test 2347.00 > > xxxxxxxxxxxxxxxxxxx > > > > > > Logoff and new login for the user, just to reload environment > > > > > > $ aubit-config A4GL_NUMERIC > > ,. > > > > $ export A4GL_NUMERIC=,. > > > > $ env|grep A4GL_NUMERIC > > A4GL_NUMERIC=,. > > > > $ ./formtest.4ae > > > > > > Input is 66656 > > > > xxxxxxxxxxxxxxxxxxx > > Test 66656,00 > > xxxxxxxxxxxxxxxxxxx > > > > > > The workaround is that exporting the variable it works. > > > > Thanks, > > Alessandro > > > > > > ---- On Fri, 18 Dec 2015 10:42:43 +0100 Mike Aubury wrote ---- > > >That these are making no difference has me worried - are you sure they > > >are not set somewhere else ? > > > > > >If you try : > > > > > >$ aubit-config A4GL_NUMERIC > > >What does that say ? > > > > > >To make absolutely sure - set it in the environment : > > > > > >$ export A4GL_NUMERIC=,. > > > > > >(I'm not sure ALLOWCOMMAINDECIMAL does anything any more - at least - > > >I cant see it in the code) > > > > > > > > > > > >On 17 December 2015 at 13:37, Alessandro Vercelli <[email protected]> wrote: > > >> Hi all, > > >> we are building an application which uses decimal numbers but something is not going as expected. > > >> > > >> Aubit4GL version is 1.2.38, binary installation on Ubuntu 12.04 32 bit. > > >> > > >> In detail, we tried to obtain numerical output with two decimal and comma separator with the following code: > > >> > > >>[..........] > > >> > > >> We made several attempt with: > > >> > > >> A4GL_ALLOWCOMMAINDECIMAL=Y (tried with or without) > > >> A4GL_NUMERIC=,. (also tried . or , or ., or disable) > > >> LANG=it_IT.UTF-8 (tried with or without) > > >> > > >> in $AUBITDIR/etc/aubitrc without any change in output, it seems these variables do not have any effect. > > >> > > >> Any help appreciated, thanks anyone > > >> > > >> Alessandro > > >> > > >> > > >> > > >> ------------------------------------------------------------------------------ > > >> _______________________________________________ > > >> Aubit4gl-discuss mailing list > > >> [email protected] > > >> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss > > > > > > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Aubit4gl-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140