mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 11:19:58 +02:00
fcl-db: added TBCDField.AsBCD support
git-svn-id: trunk@24175 -
This commit is contained in:
parent
2e1d0c07a5
commit
77e2d443d4
@ -779,6 +779,7 @@ type
|
|||||||
FCurrency : boolean;
|
FCurrency : boolean;
|
||||||
protected
|
protected
|
||||||
class procedure CheckTypeSize(AValue: Longint); override;
|
class procedure CheckTypeSize(AValue: Longint); override;
|
||||||
|
function GetAsBCD: TBCD; override;
|
||||||
function GetAsCurrency: Currency; override;
|
function GetAsCurrency: Currency; override;
|
||||||
function GetAsFloat: Double; override;
|
function GetAsFloat: Double; override;
|
||||||
function GetAsLongint: Longint; override;
|
function GetAsLongint: Longint; override;
|
||||||
@ -788,6 +789,7 @@ type
|
|||||||
function GetDataSize: Integer; override;
|
function GetDataSize: Integer; override;
|
||||||
function GetDefaultWidth: Longint; override;
|
function GetDefaultWidth: Longint; override;
|
||||||
procedure GetText(var TheText: string; ADisplayText: Boolean); override;
|
procedure GetText(var TheText: string; ADisplayText: Boolean); override;
|
||||||
|
procedure SetAsBCD(const AValue: TBCD); override;
|
||||||
procedure SetAsFloat(AValue: Double); override;
|
procedure SetAsFloat(AValue: Double); override;
|
||||||
procedure SetAsLongint(AValue: Longint); override;
|
procedure SetAsLongint(AValue: Longint); override;
|
||||||
procedure SetAsString(const AValue: string); override;
|
procedure SetAsString(const AValue: string); override;
|
||||||
|
@ -2379,6 +2379,17 @@ begin
|
|||||||
DatabaseErrorfmt(SInvalidFieldSize,[Avalue]);
|
DatabaseErrorfmt(SInvalidFieldSize,[Avalue]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBCDField.GetAsBCD: TBCD;
|
||||||
|
Var
|
||||||
|
c:system.Currency;
|
||||||
|
|
||||||
|
begin
|
||||||
|
If GetData(@c) then
|
||||||
|
Result:=CurrToBCD(c)
|
||||||
|
else
|
||||||
|
Result:=NullBCD;
|
||||||
|
end;
|
||||||
|
|
||||||
function TBCDField.GetAsCurrency: Currency;
|
function TBCDField.GetAsCurrency: Currency;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -2464,6 +2475,14 @@ begin
|
|||||||
TheText := '';
|
TheText := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBCDField.SetAsBCD(const AValue: TBCD);
|
||||||
|
var
|
||||||
|
c:system.currency;
|
||||||
|
begin
|
||||||
|
if BCDToCurr(AValue,c) then //always returns true !!
|
||||||
|
SetAsCurrency(c);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBCDField.SetAsCurrency(AValue: Currency);
|
procedure TBCDField.SetAsCurrency(AValue: Currency);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user