Browse Source

* Lookup should return an empty variant instead of false in case of failure (+test)

git-svn-id: trunk@12538 -
joost 16 years ago
parent
commit
9abc13aff1
3 changed files with 22 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      packages/fcl-db/src/base/dataset.inc
  3. 20 0
      tests/test/packages/fcl-db/tdb5.pp

+ 1 - 0
.gitattributes

@@ -7672,6 +7672,7 @@ tests/test/packages/fcl-db/tdb1.pp svneol=native#text/plain
 tests/test/packages/fcl-db/tdb2.pp svneol=native#text/plain
 tests/test/packages/fcl-db/tdb3.pp svneol=native#text/plain
 tests/test/packages/fcl-db/tdb4.pp svneol=native#text/plain
+tests/test/packages/fcl-db/tdb5.pp svneol=native#text/plain
 tests/test/packages/fcl-db/toolsunit.pas svneol=native#text/plain
 tests/test/packages/fcl-registry/tregistry1.pp svneol=native#text/plain
 tests/test/packages/hash/tmdtest.pp svneol=native#text/plain

+ 1 - 1
packages/fcl-db/src/base/dataset.inc

@@ -2294,7 +2294,7 @@ Function TDataset.Lookup(const KeyFields: string; const KeyValues: Variant; cons
 
 begin
   CheckBiDirectional;
-  Result := False;
+  Result := Null;
 end;
 
 

+ 20 - 0
tests/test/packages/fcl-db/tdb5.pp

@@ -0,0 +1,20 @@
+program LookupIsNull;
+
+uses db, memds, variants;
+
+var
+  DSet:TMemDataset;
+  tmpVariant:Variant;
+
+begin
+  DSet:=TMemDataset.Create(nil);
+  DSet.FieldDefs.Add('NAME',ftString,20);
+  DSet.CreateTable;
+  DSet.Open;
+
+  tmpVariant:=DSet.Lookup('NAME','aaaa','NAME');
+  if not (VarIsNull(tmpVariant)) then
+    Halt(1);
+  DSet.Close;
+  DSet.Free;
+end.