I have big trouble with zeos Locate.
Locate dont match records with both an clear Field. For my opinion this is wrong
Example:
I Search for
ID;VERSION;LANGUAGE
01,NULL, EN
In my Dataset exists an exact Match for this
01,NULL, EN
Zeos says thers no match couse VERSION is NULL....
In ZDataSetutils in CompareFieldsFromResultSet
is one Line at Line 10801 : Result := Result and not ResultSet.WasNull;
Thats the problem. Ive commented it out and everything is fine.
Why is this so ?
Is it needed ?
best Regards
Christian
Locate problem
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Can you make a test project (a very simple one) including a table creation script and file it in the bug tracker? (http://zeosbugs.firmos.at/)
Like a TZConnection, a TZQuery and a button which opens the query and then does the locate returning the wrong result? That's something I can debug. Don't forget to mention compiler and database you are using.
Mark
Like a TZConnection, a TZQuery and a button which opens the query and then does the locate returning the wrong result? That's something I can debug. Don't forget to mention compiler and database you are using.
Mark
Try this test (package ZTestComponentAll, unit ZTestDatasetGeneric)
procedure TZGenericTestDbcResultSet.TestQueryLocate;
var
Query: TZQuery;
ResData : boolean;
begin
Query := TZQuery.Create(nil);
try
Query.Connection := Connection;
Query.SQL.Add('select * from cargo');
Query.ExecSQL;
Query.Open;
Check(Query.RecordCount > 0, 'Query return no records');
ResData := Query.Locate('C_DEP_ID;C_WIDTH;C_SEAL',VarArrayOf(['1','10','2']),[loCaseInsensitive]);
CheckEquals(ResData,true);
ResData := Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2',varNull,'1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
finally
Query.Free;
end;
end;
First and second check are ok, but 3rd always return false
The problem is located on that line
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2',varNull,'1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
Could be?
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2',varEmpty,'1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
Could be?
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2','','1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
Could be?
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2','NULL','1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
procedure TZGenericTestDbcResultSet.TestQueryLocate;
var
Query: TZQuery;
ResData : boolean;
begin
Query := TZQuery.Create(nil);
try
Query.Connection := Connection;
Query.SQL.Add('select * from cargo');
Query.ExecSQL;
Query.Open;
Check(Query.RecordCount > 0, 'Query return no records');
ResData := Query.Locate('C_DEP_ID;C_WIDTH;C_SEAL',VarArrayOf(['1','10','2']),[loCaseInsensitive]);
CheckEquals(ResData,true);
ResData := Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2',varNull,'1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
finally
Query.Free;
end;
end;
First and second check are ok, but 3rd always return false
The problem is located on that line
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2',varNull,'1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
Could be?
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2',varEmpty,'1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
Could be?
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2','','1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
Could be?
Query.Locate('C_DEP_ID,C_WIDTH,C_SEAL',VarArrayOf(['2','NULL','1']),[loCaseInsensitive]);
CheckEquals(ResData,true);
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
seawolf,
I'm afraid your test is wrong. is equal to
Of course, this doesn't return a result.
Use
Now the tests do work correctly. I'll add them to the test suite next time I commit.
A remark : you should use instead of The expected value comes first.
Cocky,
Christian,
Waiting for an exact sample of your problem.
Mark
I'm afraid your test is wrong.
Code: Select all
VarArrayOf(['2',varNull,'1'])
Code: Select all
VarArrayOf(['2',1,'1'])
Use
Code: Select all
VarArrayOf(['2',Null,'1'])
A remark : you should use
Code: Select all
CheckEquals(true,ResData);
Code: Select all
CheckEquals(ResData,true);
Cocky,
Christian,
Waiting for an exact sample of your problem.
Mark