Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread FloatToStr problem in European countries
Thu, Sep 27 2007 12:18 PMPermanent Link

Michael Fullerton
DBISAM 3.30

I just found a really bad problem when using FloatToStr to convert a
float to text for use in a query. Certain countries use a comma
instead of a period for the decimal separator. DBISAM can't handle
this (for ANSI Standard tables anyway). Besides using parameterixed
queries or creating a lame function to convert commas to periods, what
is the solution here? Note that I use the same SQL for big database
servers too including MS SQL, MySQL and PostgresQL. Would these
database have the same problem?
Thu, Sep 27 2007 12:23 PMPermanent Link

Eryk Bottomley
Michael,

> this (for ANSI Standard tables anyway). Besides using parameterixed
> queries or creating a lame function to convert commas to periods, what
> is the solution here?

Changing the DecimalSeparator variable at runtime would be the remaining
possibility. Using parameters is the best solution however since that
makes such issues transparent.

Eryk
Fri, Sep 28 2007 1:50 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< I just found a really bad problem when using FloatToStr to convert a
float to text for use in a query. Certain countries use a comma instead of a
period for the decimal separator. DBISAM can't handle this (for ANSI
Standard tables anyway). Besides using parameterixed queries or creating a
lame function to convert commas to periods, what
is the solution here? >>

See Eryk's response.  You can also use this function in the dbisamlb.pas
unit:

AnsiFloatToStr()

<< Note that I use the same SQL for big database servers too including MS
SQL, MySQL and PostgresQL. Would these database have the same problem? >>

If they only accept the ANSI period separator for numerics like DBISAM, then
yes.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image