Michael Van Canneyt
michael at freepascal.org
Sat Sep 13 18:12:07 CEST 2008
On Sat, 13 Sep 2008, Pavel Řezníček wrote:
> Michael Van Canneyt napsal(a):
> > On Sat, 13 Sep 2008, Pavel Řezníček wrote:
> >> Hello all,
> >> On Lazarus v0.9.25 r16541 i386-win32-win32/win64, I have the following
> >> problem.
> >> I access an SQLite3 database. There I have a column defined as
> >> numeric(3), it means, 3 whole number digits and no decimal places. The
> >> table has to be synchronised with PostgreSQL using the same table name
> >> and column names. Therefore the column definition is simply taken from
> >> the PostgreSQL definition.
> >> The data is maybe stored correctly in the database but when I call the
> >> AsString property on that field, I don't get e. g. '14' as expected but
> >> '0,0014'.
> > And this is correct.
> > The string is formatted according to the default float format.
> > The underlying data format is not relevant. If you want this,
> > set the DisplayFormat property to something FormatFloat understands.
> > (I suppose '000')
> > Michael.
> Another comment:
> Display Format has no effect here because the field is considered to be
> a TBCDField and there and DisplayFormat isn't used. Or am I wrong?
> CurrToStr just calls FloatToStrF with some default parameters. No chance
> to use my own format from the point of view of the "user programmer" -
> until I go around the AsString property.
> - fields.inc, line 2212:
> function TBCDField.GetAsString: string;
> var c : system.currency;
> If GetData(@C) then
This is a bug and should be corrected.
More information about the Lazarus