[patch_done] AnyZQuery.Locate not working

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
7bit
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.10.2012, 19:52

[patch_done] AnyZQuery.Locate not working

Post by 7bit »

Does not work if Keyvalues ​​- an array that contains the text of the Nationals. The problem is that it compares the text encodings. Maybe the problem is TZSoftVariantManager.Convert. These are:
...
vtUnicodeString:
Result.VString: = {$ IF[s]N[/s]DEF DELPHI12_UP} UTF8Encode {$ ENDIF} (Value.VUnicodeString);
...

P.S. Lazarus 1.0. Zeos 7.0.1b
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

7bit,

is it possible you've used the locate/filter on a non windows plattform? Or does this issue happens allways?

I've the impression your suggestion won't fix the issue because the ZVariantType vtUnicodeString shouldn't be used for FPC except you use TZConnection.UTF8AsWidstring. Do you?

My idea is much mure an missing unit cwstring (widestring-manager unit which handles UTF8ToAnsi/AnsiToUTF8 etc) in ZDatasetUtils.pas.

As far as i do understand the FPC docs is this unit needed to have success with the charconverting on the other hand functions like AnsStrLCompare ets won't be successfull.

Can you test my suggestion?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
7bit
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.10.2012, 19:52

Post by 7bit »

I can not test your suggestion. I use the platform Windows.
I was wrong. I do not quite understand how the type Variant. Locate works if KeyValues ​​- string. But if KeyValues ​​is an array, such as an array of one element ['Text'], then Locate not working. Debugging function DecodeVariant, I found that in the first case the parameter type varString, and in the second varOleStr. Why? ..
Attached example.

P.S. In 7.0.0a all worked
You do not have the required permissions to view the files attached to this post.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

7bit,

i've testet your app. And you are right we can't loacate the values. I'll check the issue tommorow. the varOleStr will be assumed by the FPC for you national char string. To avoid that Variant type you could use VarArrayOf([UTF8Encode(WideString('Арбуз'))]). So we do compare ststring=stString. That might be a new behavior with the FPC.

I' wondering why the second locate works like expected or better: Why does the FPC NOT assumes varOleStr again like in the VarArray? Bug?

Well i've to check what String type is used for varOleStr. Delphi uses the WideString here so the comparsion is correct. Does the FPC use a 1Byte-String instead?

Any proposals?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

7bit,

i did check a lot but a !real! solution was NOT to find. So i've added a new define WITH_FPC_VARARRAY_BUG to improve this issue. Your solution seems to be the only one which solves the issue on our side. BUT the problem 'em selves is NOT a Zeos-Issue. It is really an FPC bug with the VarArrayOf function.

Today morning i wanted to open an issue report on the FPC bugtracker accordingly this issue. But i found this: http://bugs.freepascal.org/view.php?id=23149. Is that your issue report?

Anyway i hope this improvement does not make trouble on other places. If so then i'll remove it again, ok?

Patch done R1923 \testing

can you confirm the issue is solved/improved?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

Lazarus 1.0.8 fpc 2.6.0
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

I tested R1923 \testing all working
Lazarus 1.0.8 fpc 2.6.0
7bit
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.10.2012, 19:52

Post by 7bit »

EgonHugeist,

All working. Yes, this is my issue. I understood why VarType (VarArrayOf (['Text']) [0]) = varOleStr. VarArrayOf calls VarArrayCreate (... vtVariant). In FPC string assigned to the element of the array (array vtVariant), transforming function VarToWideStr (Module Variants procedure sysvararrayput). But the problem that I have not decided. In short, was drowned in the code.
Locked