Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-05

another pqconnection patch

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joao Morais

Hello,

the following patch fixes the storage of floating point numbers where the decimal point isn't a dot.

Joao Morais

Joost van der Sluis
to Joao Morais

Op woensdag 28-05-2008 om 18:33 uur [tijdzone -0300], schreef Joao Morais:

the following patch fixes the storage of floating point numbers where the decimal point isn't a dot.

Two questions: does postgres always request a dot as decimal point? And dos your code guarantee to use a dot as decimal point? Or is 'str' locale-dependent? Maybe better use FloatToStr with a given locale-setting?

Joost

Show quoted text 16 lines
Index: packages/fcl-db/src/sqldb/postgres/pqconnection.pp =================================================================== --- packages/fcl-db/src/sqldb/postgres/pqconnection.pp (revision 11085) +++ packages/fcl-db/src/sqldb/postgres/pqconnection.pp (working copy) @@ -568,6 +568,8 @@ case AParams[i].DataType of ftdatetime : s := formatdatetime('YYYY-MM-DD',AParams[i].AsDateTime); ftdate : s := formatdatetime('YYYY-MM-DD',AParams[i].AsDateTime); + ftFloat, + ftCurrency : str(AParams[i].AsFloat, s); else s := AParams[i].asstring; end; {case}
Jonas Maebe
to Joost van der Sluis
Joost van der Sluis wrote
Two questions: does postgres always request a dot as decimal point? And dos your code guarantee to use a dot as decimal point? Or is 'str' locale-dependent?

str() is never locale-dependent.

Jonas

Joao Morais
to Joost van der Sluis: Op woensdag 28-05-2008 om 18:33 uur [tijdzone -0300], schreef Joao Morais: Two questions:…
Joost van der Sluis wrote 6 lines
Op woensdag 28-05-2008 om 18:33 uur [tijdzone -0300], schreef Joao Morais: > the following patch fixes the storage of floating point numbers where > the decimal point isn't a dot. Two questions: does postgres always request a dot as decimal point?

Yes.

Or is 'str' locale-dependent?

Str is a fast and jurassic procedure declared in the system unit, which know nothing about locale.

There are other problems, at least with timestamp field. Please wait another patch soon.

Joao Morais

Joao Morais
to Joao Morais
Joao Morais wrote
There are other problems, at least with timestamp field. Please wait another patch soon.

The following patch fixes the storage of floating point, time and timestamp fields on a pgsql database.

Patch is against trunk.

Joao Morais