Re: [fpc-devel] TFmtBCDField

2011-02-22 Thread LacaK

Hi Joost,
thanks!
Thinking about TFmtBCDField it seems to me, that also dsparams.inc must 
be adjusted to support ftFMTBcd ... add AsBCD: TBCD etc. ... at least my 
test with new TSQLite3Connection shows, that there is missing it (when 
applyng updates to record)

Do you have already finished implementing ftFMTBcd into TSQLite3Connection ?



4. Add 3th parameter to TryStrToBCD( const aValue : FmtBCDStringtype;  
var BCD : tBCD;  DecimalSeparator : char = #0) : Boolean;
so we can supply directly decimal separator '.' used in SQL and to avoid 
saving existing, set '.' and then restoring ... 
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp?r1=16948&r2=16954

(like TryStrToDate, TryStrToTime)
or
 add overloaded TryStrToBCD( const aValue : FmtBCDStringtype;  var BCD : 
tBCD;  FormatSettings : TFormatSettings) : Boolean;

(like TryStrToFloat)



And could you add a bug-report for this? I think that Marco or MvC
should have a look at it and have to decide which design is best and
also compatible to Delphi. Then the db-changes can be made.
  

Bug report is here http://bugs.freepascal.org/view.php?id=18807
If this way will be approved, then we can very nice use it (no need to 
initialize something, store/restore) for example:

 ...
 if not TryStrToBCD(bcdstr,bcd,SQLFormatSettings) then  
 ...

we must only add into TSQLConnection:
   property SQLFormatSettings: TFormatSettings read 
FSQLServerFormatSettings;


FSQLServerFormatSetting already exists as private variable

Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TFmtBCDField

2011-02-22 Thread Joost van der Sluis
On Mon, 2011-02-21 at 09:22 +0100, LacaK wrote:
> 1. VarFMTBcdCreate() should already work, so:

Done

> 2. VarToBCD() is already implemented, so:

Done

> 3. BCDToStrF there is waiting patch 
> http://bugs.freepascal.org/view.php?id=18388 if applied, then also can 
> be removed comments in procedure TFMTBCDField.GetText

I'll leave this bug open for Marco.

> 4. Add 3th parameter to TryStrToBCD( const aValue : FmtBCDStringtype;  
> var BCD : tBCD;  DecimalSeparator : char = #0) : Boolean;
> so we can supply directly decimal separator '.' used in SQL and to avoid 
> saving existing, set '.' and then restoring ... 
> http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp?r1=16948&r2=16954
> (like TryStrToDate, TryStrToTime)
> or
>  add overloaded TryStrToBCD( const aValue : FmtBCDStringtype;  var BCD : 
> tBCD;  FormatSettings : TFormatSettings) : Boolean;
> (like TryStrToFloat)

And could you add a bug-report for this? I think that Marco or MvC
should have a look at it and have to decide which design is best and
also compatible to Delphi. Then the db-changes can be made.

Joost

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] TFmtBCDField

2011-02-21 Thread LacaK

Hi Joost,
it seems, that you have started applying patch in 
http://bugs.freepascal.org/view.php?id=18160 or 
http://bugs.freepascal.org/view.php?id=16924

Great!
I have some comments, ideas, please consider them.
Because in mean time was enhanced FmtBCD unit you can remove some 
commented lines in fields.inc


1. VarFMTBcdCreate() should already work, so:
2447-Result := BCDToDouble(bcd)//remove when complete 
variant support in fmtbcd.pp will be implemented
2448-//Result := VarFMTBcdCreate(bcd) //later invalid 
variant type cast ?

2448+Result := VarFMTBcdCreate(bcd)

2. VarToBCD() is already implemented, so:
2548procedure TFMTBCDField.SetVarValue(const AValue: Variant);
2549-   var E:double;
2550begin
2551- E:=AValue;
2552- SetAsBCD(DoubleToBCD(E));//remove when VarToBCD in 
fmtbcd.pp will be implemented

2553- //SetAsBCD(VarToBCD(AValue));
2553+SetAsBCD(VarToBCD(AValue));
2554end;

3. BCDToStrF there is waiting patch 
http://bugs.freepascal.org/view.php?id=18388 if applied, then also can 
be removed comments in procedure TFMTBCDField.GetText


4. Add 3th parameter to TryStrToBCD( const aValue : FmtBCDStringtype;  
var BCD : tBCD;  DecimalSeparator : char = #0) : Boolean;
so we can supply directly decimal separator '.' used in SQL and to avoid 
saving existing, set '.' and then restoring ... 
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp?r1=16948&r2=16954

(like TryStrToDate, TryStrToTime)
or
add overloaded TryStrToBCD( const aValue : FmtBCDStringtype;  var BCD : 
tBCD;  FormatSettings : TFormatSettings) : Boolean;

(like TryStrToFloat)

Thanks
Laco.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel