[Lazarus] Install local help; extend help; debug, evaluate/modify window

Tom Verhoeff T.Verhoeff at tue.nl
Sun Sep 14 23:10:15 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:
> >
> >   
> >> 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;
> >>
> >> begin
> >>   If GetData(@C) then
> >>     Result:=CurrToStr(C)
> >>   else
> >>     Result:='';
> >> end;
> >>     
> >
> > This is a bug and should be corrected.
> >
> > Michael.
> By the way, where is the (main) problem? Please choose:
> 
> 1) numeric(3) in the SQLite3 DB being interpreted as BCD/Currency (Is 
> that correct? Shouldn't it be read just as a float - Double or Extended? 
> I don't know…)
> 2) CurrToStr used, not allowing the DisplayFormat property to be applied
> 3) bad formatting by FloatToStrIntl (14 -> '0,0014')

2 is the problem.

Michael.


More information about the Lazarus mailing list