Locate problem

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Christian
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 03.09.2008, 21:05

Locate problem

Postby Christian » 03.09.2008, 21:11

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

Cocky
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 18.11.2008, 12:41

Postby Cocky » 18.11.2008, 16:20

I would be also interested in an answer. :D

best regards

Cocky

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Postby mdaems » 18.11.2008, 20:45

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
Image

seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Postby seawolf » 19.11.2008, 09:48

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);

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Postby mdaems » 20.11.2008, 00:04

seawolf,
I'm afraid your test is wrong.

Code: Select all

VarArrayOf(['2',varNull,'1'])
is equal to

Code: Select all

VarArrayOf(['2',1,'1'])

Of course, this doesn't return a result.
Use

Code: Select all

VarArrayOf(['2',Null,'1'])

Now the tests do work correctly. I'll add them to the test suite next time I commit.
A remark : you should use

Code: Select all

CheckEquals(true,ResData);
instead of

Code: Select all

CheckEquals(ResData,true);
The expected value comes first.

Cocky,
Christian,
Waiting for an exact sample of your problem.

Mark
Image

Christian
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 03.09.2008, 21:05

Postby Christian » 29.11.2008, 09:29

With actual SVN it seems to work now. Have removed my patch from my local code repositore and first try seems to work.


Return to “6.5.1 (alpha) - 6.6.x (beta)”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest