Browse Source

fcl-db: base: add AsLargeInt for TFloatField

git-svn-id: trunk@23071 -
lacak 12 years ago
parent
commit
502ed76da2
2 changed files with 12 additions and 0 deletions
  1. 2 0
      packages/fcl-db/src/base/db.pas
  2. 10 0
      packages/fcl-db/src/base/fields.inc

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

@@ -633,12 +633,14 @@ type
     procedure SetPrecision(const AValue: Longint);
   protected
     function GetAsFloat: Double; override;
+    function GetAsLargeInt: LargeInt; override;
     function GetAsLongint: Longint; override;
     function GetAsVariant: variant; override;
     function GetAsString: string; override;
     function GetDataSize: Integer; override;
     procedure GetText(var theText: string; ADisplayText: Boolean); override;
     procedure SetAsFloat(AValue: Double); override;
+    procedure SetAsLargeInt(AValue: LargeInt); override;
     procedure SetAsLongint(AValue: Longint); override;
     procedure SetAsString(const AValue: string); override;
     procedure SetVarValue(const AValue: Variant); override;

+ 10 - 0
packages/fcl-db/src/base/fields.inc

@@ -1797,6 +1797,11 @@ begin
     Result:=Null;
 end;
 
+function TFloatField.GetAsLargeInt: LargeInt;
+begin
+  Result:=Round(GetAsFloat);
+end;
+
 function TFloatField.GetAsLongint: Longint;
 
 begin
@@ -1864,6 +1869,11 @@ begin
     RangeError(AValue,FMinValue,FMaxValue);
 end;
 
+procedure TFloatField.SetAsLargeInt(AValue: LargeInt);
+begin
+  SetAsFloat(AValue);
+end;
+
 procedure TFloatField.SetAsLongint(AValue: Longint);
 
 begin