Browse Source

fcl-db: tests: add support for ftLongWord, ftShortInt, ftByte field types to TBufDataset + basic test

git-svn-id: trunk@47224 -
(cherry picked from commit 6c2554af69295f35a5ae71cac937623082025422)
lacak 4 years ago
parent
commit
ec3eeec9ef

+ 9 - 3
packages/fcl-db/src/base/bufdataset.pas

@@ -1590,10 +1590,13 @@ begin
                  ftWideString : F1.AsWideString:=F2.AsWideString;
                  ftBoolean  : F1.AsBoolean:=F2.AsBoolean;
                  ftFloat    : F1.AsFloat:=F2.AsFloat;
+                 ftShortInt,
+                 ftByte,
                  ftAutoInc,
                  ftSmallInt,
                  ftInteger  : F1.AsInteger:=F2.AsInteger;
                  ftLargeInt : F1.AsLargeInt:=F2.AsLargeInt;
+                 ftLongWord : F1.AsLongWord:=F2.AsLongWord;
                  ftDate     : F1.AsDateTime:=F2.AsDateTime;
                  ftTime     : F1.AsDateTime:=F2.AsDateTime;
                  ftTimestamp,
@@ -2463,16 +2466,19 @@ begin
       ftFixedChar: result := FieldDef.Size*FieldDef.CharSize + 1;
     ftFixedWideChar,
       ftWideString:result := (FieldDef.Size + 1)*FieldDef.CharSize;
-    ftSmallint,
+    ftShortint,
+      ftByte,
+      ftSmallint,
+      ftWord,
       ftInteger,
-      ftAutoInc,
-      ftword     : result := sizeof(longint);
+      ftAutoInc  : result := sizeof(longint);
     ftBoolean    : result := sizeof(wordbool);
     ftBCD        : result := sizeof(currency);
     ftFmtBCD     : result := sizeof(TBCD);
     ftFloat,
       ftCurrency : result := sizeof(double);
     ftLargeInt   : result := sizeof(largeint);
+    ftLongWord   : result := sizeof(longword);
     ftTime,
       ftDate,
       ftDateTime : result := sizeof(TDateTime);

+ 5 - 0
packages/fcl-db/tests/bufdatasettoolsunit.pas

@@ -155,6 +155,9 @@ begin
     FieldDefs.Add('FWIDESTRING',ftWideString,10);
     FieldDefs.Add('FFIXEDWIDECHAR',ftFixedWideChar,10);
     FieldDefs.Add('FWIDEMEMO',ftWideMemo);
+    FieldDefs.Add('FLONGWORD',ftLongWord);
+    FieldDefs.Add('FSHORTINT',ftShortInt);
+    FieldDefs.Add('FBYTE',ftByte);
     CreateDataset;
     Open;
     for i := 0 to testValuesCount-1 do
@@ -183,6 +186,8 @@ begin
       FieldByName('FWIDESTRING').AsString := testStringValues[i];
       FieldByName('FFIXEDWIDECHAR').AsString := PadRight(testStringValues[i], 10);
       FieldByName('FWIDEMEMO').AsString := testStringValues[i];
+      FieldByName('FLONGWORD').AsLongWord := testWordValues[i];
+      FieldByName('FBYTE').AsInteger := testByteValues[i];
       Post;
     end;
     MergeChangeLog;

+ 1 - 0
packages/fcl-db/tests/toolsunit.pas

@@ -131,6 +131,7 @@ const
   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);
+  testByteValues: Array[0..testValuesCount-1] of Byte = (1,2,3,4,5,6,7,8,0,1,127,128,255,0,0,0,0,0,0,0,0,0,0,0,0);
   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 = (