Subject Re: [ib-support] to change the decimal separator
Author aandea_launch
Hello All,

Thank you for the repliesÂ… Here is some of my feedback :

The queries I sent are not always generated by our system. We have
an extensible architecture which accepts queries written by 3rd party
developers. These queries have the same issues with the decimal
separator as comma (the numbers in this queries will use comma as
decimal separator in German OS and other European OS). This has 2
implications:
1. It is very hard for me to use params as the Queries received from
3rd party plugins are free form. Thus, we have a global function which
receives a string and returns back a TDataSet (descendent). This
function is reserved for authenticated 3rd party extensions. However,
I must (currently) pass query as a String. Thus, it will be statically
formatted.
2. It is very hard to do replace on the comma also n the generalized
SQL string as the comma might be a valid character as part of a true
string. (e.g. Select Id from Customer where Description like "%
,SMITH%" ). I could probably do some "smart" parsing that will detect
is comma is part of the string, however,

I would like to return back to the original question:

Can we make the Embedded Firebird Engine (v1.5 or v2.0) to be aware
of the OS locale for converting strings to decimal numbers?

If yes, can you please indicate the setting for this?
If no, per a prior message, this is might be a SQL standard.
However, I have "briefly" looked over SQL-92 specification and I have
not seen any mentioning of the decimal separator issue in this
document. Can you please indicate where is such specified (and thus
enforced by Firebird)?

Thank you!
Alin Andea

--- In firebird-support@yahoogroups.com, Alexandre Benson Smith
<iblist@...> wrote:
>
> Adam wrote:
> > FloatToStr is a Delphi function not a Firebird function. If it doesn't
> > work properly with Regional settings, check out the Delphi support
forums.
> >
> > Why are you passing a fixed string SQL where a parameter should be
used?
> >
> > In delphi, it is something like:
> >
> > qry.sql.text := 'Select ID from the EVENTS where VALUE < :somevalue';
> > qry.parambyname('somevalue').Value := MyFloatVariable;
> > qry.open;
> >
> > Parameters mean that you are not worrying about formatting preferences
> > when dealing with data.
> >
> > Adam
> >
>
> Adam,
>
> I think he is saying that the application when running on countries
that
> uses comma as a decimal separator (instead of point like in USA) the
> numbers are formated with commas by the StrToFloat.
>
> I face it every time :-)
>
> I have a FloatToStrSQL function that lookslike this:
>
> function FloatToStrSQL(D:Extended):String;
>
> var
> wDecimalSeparator:Char;
>
> begin
> wDecimalSeparator := DecimalSeparator;
> DecimalSeparator := '.'
> try
> Result := FloatToStr(D);
> finally
> DecimalSeparator := wDecimalSeparator;
> end;
> end;
>
>
> this way I am always sure I will use a point as a Decimal Separator no
> matter how the current locale are set.
>
> see you !
>
> --
> Alexandre Benson Smith
> Development
> THOR Software e Comercial Ltda
> Santo Andre - Sao Paulo - Brazil
> www.thorsoftware.com.br
>