A problem with the new IndexFieldNames / SortedFields

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

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
gto
Zeos Dev Team
Zeos Dev Team
Posts: 278
Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil

A problem with the new IndexFieldNames / SortedFields

Post by gto »

Hello there!
I was building an program that uses zeos with the latest version due to some changes that costumer asked to me and one simple problem pop up:

I know that IndexFieldNames was changed some time ago. It doesn't matter to me, as I don't use it. But in this old program (that was converted from BDE, and used IndexFieldNames in the past), I may forgot some IndexFieldNames filled up. Doesn't matter too, becouse I've never had any problems. But with the new version, there is a problem. The IndexFieldNames was self completed with an 'Asc' (from Ascending) after the fields definitions, and, the big problem, a while not query.eof construction became an infinite loop. Removed the IndexFieldNames property (leave it blank) and everything works again.

Look to me that every time that the ZQuery Recevied the .Next command, it tries to reorder the data, and take the position of cursor to BOF (the first record), as my loop always stop in the second row.

Anyone with the same problem? It's not a * problem * at all, as I've resolved it removing the property values. But may become a problem for anyone that may use it.

[]'s
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
bangfauzan
Senior Boarder
Senior Boarder
Posts: 50
Joined: 31.08.2006, 10:41
Contact:

Post by bangfauzan »

Hi, gto

The purpose of the new IndexFieldNames is for sorting only, as combination of the new behavior of SortedFieldNames and SortType.

If u converted from BDE that use IndexFieldNames, you now can use LinkedFields (as master detail relationship). LinkedFields has the same behavior as old IndexFieldNames.

Conclusion:
- the old IndexFieldNames was replaced by LinkedFields, so LinkedFields is similar (or equal) with IndexFieldNames in other standard components.
- the new IndexFieldNames is another way in performing order.

Regards

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

Post by mdaems »

Hi Fauzan,

I think you missed the major problem gto wants to tell us. Is it right that every call to next can trigger a reorder and an infinite loop when you 'next till eof'?
Maybe you can exchange some examples with gto?

Mark
bangfauzan
Senior Boarder
Senior Boarder
Posts: 50
Joined: 31.08.2006, 10:41
Contact:

Re: A problem with the new IndexFieldNames / SortedFields

Post by bangfauzan »

gto wrote:and, the big problem, a while not query.eof construction became an infinite loop.
I used this component (6.6.0 beta) in production environment, and everythink ok. Here an example based on your cases. Using Mysql 5 I also attach the database script (contoh.sql). No problem at all.

can u send me the example of your cases please?

regards

Fauzan
You do not have the required permissions to view the files attached to this post.
gto
Zeos Dev Team
Zeos Dev Team
Posts: 278
Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil

Post by gto »

That's right, the demo from bangfauzan works ok. I cannot post a demo becouse it was part of a big project, and it should be a isolated problem. Thanks anyway :)
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
User avatar
cipto_kh
Senior Boarder
Senior Boarder
Posts: 83
Joined: 28.09.2005, 11:22
Location: Indonesia
Contact:

Sort 2 fields

Post by cipto_kh »

What about if I want to sort that base on 2 fields, the one is sort asc and the other desc. How to make it work? I mean by using that new property (not using SQL query)

TIA
bangfauzan wrote:Hi, gto

The purpose of the new IndexFieldNames is for sorting only, as combination of the new behavior of SortedFieldNames and SortType.

If u converted from BDE that use IndexFieldNames, you now can use LinkedFields (as master detail relationship). LinkedFields has the same behavior as old IndexFieldNames.

Conclusion:
- the old IndexFieldNames was replaced by LinkedFields, so LinkedFields is similar (or equal) with IndexFieldNames in other standard components.
- the new IndexFieldNames is another way in performing order.

Regards

Fauzan
bangfauzan
Senior Boarder
Senior Boarder
Posts: 50
Joined: 31.08.2006, 10:41
Contact:

Post by bangfauzan »

As far as I know, currently the property able only sorting one or more fields in one order method (asc only or desc only).
If you want to sort 2 fields in different order, the only way is by sql script.

regards.
Post Reply