Browse Source

fcl-db: base: add AsLargeInt for TFMTBCDField

git-svn-id: trunk@23068 -
lacak 12 years ago
parent
commit
cf5bd7e5c1
2 changed files with 17 additions and 3 deletions
  1. 4 2
      packages/fcl-db/src/base/db.pas
  2. 13 1
      packages/fcl-db/src/base/fields.inc

+ 4 - 2
packages/fcl-db/src/base/db.pas

@@ -820,6 +820,7 @@ type
     function GetAsBCD: TBCD; override;
     function GetAsCurrency: Currency; override;
     function GetAsFloat: Double; override;
+    function GetAsLargeInt: LargeInt; override;
     function GetAsLongint: Longint; override;
     function GetAsString: string; override;
     function GetAsVariant: variant; override;
@@ -828,6 +829,7 @@ type
     procedure GetText(var TheText: string; ADisplayText: Boolean); override;
     procedure SetAsBCD(const AValue: TBCD); override;
     procedure SetAsFloat(AValue: Double); override;
+    procedure SetAsLargeInt(AValue: LargeInt); override;
     procedure SetAsLongint(AValue: Longint); override;
     procedure SetAsString(const AValue: string); override;
     procedure SetAsCurrency(AValue: Currency); override;
@@ -1064,7 +1066,7 @@ type
 
 { TFields }
 
-  Tfields = Class(TObject)
+  TFields = Class(TObject)
     Private
       FDataset : TDataset;
       FFieldList : TFpList;
@@ -1765,7 +1767,7 @@ type
   TMasterParamsDataLink = Class(TMasterDataLink)
   Private
     FParams : TParams;
-    Procedure SetParams(AVAlue : TParams);
+    Procedure SetParams(AValue : TParams);
   Protected
     Procedure DoMasterDisable; override;
     Procedure DoMasterChange; override;

+ 13 - 1
packages/fcl-db/src/base/fields.inc

@@ -2578,6 +2578,15 @@ begin
     Result := 0;
 end;
 
+function TFMTBCDField.GetAsLargeInt: LargeInt;
+var bcd: TBCD;
+begin
+  if GetData(@bcd) then
+    Result := BCDToInteger(bcd)
+  else
+    Result := 0;
+end;
+
 function TFMTBCDField.GetAsLongint: Longint;
 begin
   Result := round(GetAsFloat);
@@ -2669,13 +2678,16 @@ begin
   SetAsBCD(DoubleToBCD(AValue));
 end;
 
+procedure TFMTBCDField.SetAsLargeInt(AValue: LargeInt);
+begin
+  SetAsBCD(IntegerToBCD(AValue));
+end;
 
 procedure TFMTBCDField.SetAsLongint(AValue: Longint);
 begin
   SetAsBCD(IntegerToBCD(AValue));
 end;
 
-
 procedure TFMTBCDField.SetAsString(const AValue: string);
 begin
   if AValue='' then