Переглянути джерело

fcl-db: bufdataset: fix ftBCD field compare function. ftBCD fields are using currency data type, which is 64 bit long, so compare function must be for 64 bit long integer not for 32 bit long.
+ update test values for ftBCD fields, which was too small and not able catch problem.

git-svn-id: trunk@27613 -

lacak 11 роки тому
батько
коміт
e09f9bf781

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

@@ -1767,9 +1767,9 @@ begin
         ACompareRec.CompareFunc := @DBCompareWideText;
       ftSmallint:
         ACompareRec.CompareFunc := @DBCompareSmallInt;
-      ftInteger, ftAutoInc, ftBCD:
+      ftInteger, ftAutoInc:
         ACompareRec.CompareFunc := @DBCompareInt;
-      ftLargeint:
+      ftLargeint, ftBCD:
         ACompareRec.CompareFunc := @DBCompareLargeInt;
       ftWord:
         ACompareRec.CompareFunc := @DBCompareWord;

+ 2 - 2
packages/fcl-db/tests/toolsunit.pas

@@ -124,12 +124,12 @@ const
 const
   testValuesCount = 25;
   testFloatValues : Array[0..testValuesCount-1] of double = (-maxSmallint-1,-maxSmallint,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint+1,0.123456,-0.123456,4.35,12.434E7,9.876e-5,123.45678,2.4,3.2,0.4,23);
-  testCurrencyValues : Array[0..testValuesCount-1] of currency = (-100,-65.5,-54.34,-43.34,-2.50,-0.2,45.40,0.3,45.4,127,128,255,256,45,0.3,45.4,127,128,255,256,45,1234.56,43.23,43.43,99.88);
+  testCurrencyValues : Array[0..testValuesCount-1] of currency = (-MaxLongInt-1,-MaxSmallint-1,-256,-255,-43.3434,-2.505,-0.21,0,0.3234,45.45,255,256,45,1234.56,12.3456,0.1234,MaxSmallInt+1,MaxLongInt+1,-6871947.6736,68719476736,2748779069.44,-922337203685.476,92233720368.5476,-922337203685477,922337203685477);
   testFmtBCDValues : Array[0..testValuesCount-1] of string = ('-100','-65.5','-54.3333','-43.3334','-2.5','-0.234567','45.4','0.3','45.414585','127','128','255','256','45','0.3','45.4','127','128','255','256','45','1234.56789','43.23','43.500001','99.88');
   testIntValues : Array[0..testValuesCount-1] of integer = (-maxInt,-maxInt+1,-maxSmallint-1,-maxSmallint,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint+1,MaxInt-1,MaxInt,100,130,150,-150,-132,234);
   testWordValues : Array[0..testValuesCount-1] of Word = (1,2,3,4,5,6,7,8,0,1,127,128,255,256,maxSmallint,maxSmallint+1,maxSmallInt-1,maxSmallInt,65535,100,130,150,151,132,234);
   testSmallIntValues : Array[0..testValuesCount-1] of smallint = (-maxSmallint,-maxSmallint+1,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint-1,100,110,120,130,150,-150,-132,234,231,42);
-  testLargeIntValues : Array[0..testValuesCount-1] of LargeInt = ( -$7fffffffffffffff,-$7ffffffffffffffe,-maxInt-1,-maxInt+1,-maxSmallint,-maxSmallint+1,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint-1,maxSmallint+1,MaxInt-1,MaxInt,$7fffffffffffffff-1,$7fffffffffffffff,235253244);
+  testLargeIntValues : Array[0..testValuesCount-1] of LargeInt = (-$7fffffffffffffff,-$7ffffffffffffffe,-maxInt-1,-maxInt+1,-maxSmallint,-maxSmallint+1,-256,-255,-128,-127,-1,0,1,127,128,255,256,maxSmallint,maxSmallint-1,maxSmallint+1,MaxInt-1,MaxInt,$7fffffffffffffff-1,$7fffffffffffffff,235253244);
   testBooleanValues : Array[0..testValuesCount-1] of boolean = (true,false,false,true,true,false,false,true,false,true,true,true,false,false,false,false,true,true,true,true,false,true,true,false,false);
   testStringValues : Array[0..testValuesCount-1] of string = (
     '',