Browse Source

fcl-db: base: increase default Precision for TBCDField and TFmtBCDField from 15 to 18. 15 was probably copy-paste from TFloatField. TBCDField uses currency data type as native storage type, so use MaxBCDPrecision = 18 is appropriate.
(Note: Delphi sets default Precision,Size for TBCDField:0,4 and for TFMTBCDField:0,8)

git-svn-id: trunk@30702 -

lacak 10 years ago
parent
commit
1b9e1eb1d8
2 changed files with 5 additions and 5 deletions
  1. 1 1
      packages/fcl-db/src/base/db.pas
  2. 4 4
      packages/fcl-db/src/base/fields.inc

+ 1 - 1
packages/fcl-db/src/base/db.pas

@@ -853,7 +853,7 @@ type
     function CheckRange(AValue : TBCD) : Boolean;
     function CheckRange(AValue : TBCD) : Boolean;
     property Value: TBCD read GetAsBCD write SetAsBCD;
     property Value: TBCD read GetAsBCD write SetAsBCD;
   published
   published
-    property Precision: Longint read FPrecision write FPrecision default 15;
+    property Precision: Longint read FPrecision write FPrecision default 18;
     property Currency: Boolean read FCurrency write FCurrency;
     property Currency: Boolean read FCurrency write FCurrency;
     property MaxValue: string read GetMaxValue write SetMaxValue;
     property MaxValue: string read GetMaxValue write SetMaxValue;
     property MinValue: string read GetMinValue write SetMinValue;
     property MinValue: string read GetMinValue write SetMinValue;

+ 4 - 4
packages/fcl-db/src/base/fields.inc

@@ -2581,8 +2581,8 @@ begin
   FMinValue := 0;
   FMinValue := 0;
   FValidChars := [DecimalSeparator, '+', '-', '0'..'9'];
   FValidChars := [DecimalSeparator, '+', '-', '0'..'9'];
   SetDataType(ftBCD);
   SetDataType(ftBCD);
-  FPrecision := 15;
-  Size:=4;
+  Precision := 18;
+  Size := 4;
 end;
 end;
 
 
 
 
@@ -2603,8 +2603,8 @@ begin
   SetDataType(ftFMTBCD);
   SetDataType(ftFMTBCD);
 // Max.precision for NUMERIC,DECIMAL datatypes supported by some databases:
 // Max.precision for NUMERIC,DECIMAL datatypes supported by some databases:
 //  Firebird-18; Oracle,SqlServer-38; MySQL-65; PostgreSQL-1000
 //  Firebird-18; Oracle,SqlServer-38; MySQL-65; PostgreSQL-1000
-  Precision := 15; //default number of digits
-  Size:=4; //default number of digits after decimal place
+  Precision := 18; //default number of digits
+  Size := 4; //default number of digits after decimal place
 end;
 end;
 
 
 function TFMTBCDField.GetDataSize: Integer;
 function TFMTBCDField.GetDataSize: Integer;