Design question

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Dec 3 09:19:22 CST 2003


on 12/3/03 3:52 AM, Arthur Clemens at aclemens at xs4all.nl wrote:

Hi Arthur,

> The basic question is: how do I create a set that I can use to
> accomplish this?

> I have several options, but I am not sure what is a good choice design
> wise or performance wise.
> 
> 1)
> Create a FBL_BitSet of Record->SelectAllRecords(), then create an
> FBL_ArraySet out of this.
> I cannot just create a set of SloveneWord.RecIDs, as empty entries can
> exist (a Record with nothing filled in for SloveneWord) - these should
> be visible as empty lines in the UI table.
> Problem: how to sort Record.RecIDs on the basis of a field in a child
> table?
> Possible solution:
> For each Record.RecID:
> - Find a SloveneWord where its parent equals the Record.RecID, and its
> sort_order is 0.
> - Of the found SloveneWord, feed its SloveneWord.text to a compare
> function.
> I can use the same principle to get FormalDescription.modification_date
> when sorting on date.
> Is this super slow? Is there a better way?

This is hard task -- sorting on fields of related tables.
I have work on this tasks 3 years!
Because we will need this for Table Inheritance.

I think the best way for your task -- to use SQL and JOINS,
Where I have implement this algorithm. I think this will be the fastest way
for you resolve such task.

BitSets and ArraySets are good for one table, or 1 : M tables,
When you navigate from one record to related M.

But you want JOINS, this is other very complex structure.


> 2)
> Create a FBL_Cursor from a SqlSelect query:
>        "SELECT record.RecID, slovene_word.parent,
> slovene_word.sort_order "
>        "FROM record, slovene_word "
>        "WHERE slovene_word.sort_order = 0"
> 
> But this does skip empty SloveneWord (NULL) entries. And I think it is
> not possible to create a set from a cursor.

To not skip NULL I think you need use OUTER JOIN.

You need just find correct SQL query.
Move in this direction.

You can SELECT RecID only of left table if you need.
Then iterate this cursor and make Set if you want this.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list