API methods on binary link // Philosophy (!!)

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Jan 25 10:27:21 CST 2005


On 1/22/05 8:37 PM, "Olivier" <vidal_olivier at yahoo.fr> wrote:

Hi Oliver,

It seems to me, that your task better solve in the SQL. You need do joins,
you need sort joins, you need display results of joins to user in the table.

Navigational model, as I have told, oriented on other tasks. It is good for
tasks when algorithm require navigation from record to record, to do some
calculations...

Or may be you need change your mind a little, and way how work your app.

***********************************************
** Now I want to make VERY IMPORTANT points: **
***********************************************

* the main idea of relational model is that you split data into different
tables, then you combine them back using JOINs.

* how looks join usually? One record of parent table is MANY times joined
with records from child table.

    T1.f1   T1.f2       T2.aaa1   T2.aaa2
    T1.f1   T1.f2       T2.bbb1   T2.bbb2
    T1.f1   T1.f2       T2.ccc1   T2.ccc2
    T1.f1   T1.f2       T2.ddd1   T2.ddd2

* What you get as join table?
        apples + oranges

Look on your table:
        Paris + street

But may be it is better to show to user
    list of cities:
    AND the parent list of streets?

In this case PARIS will present only once on monitor.
And streets will be show in other datagrid.

This solution CAN BE much better because

1) you do not spend time to build JOIN table.
2) you do not eat any bytes for JOIN.
3) on monitor you eat less space for duplicates of PARIS.

4) it will work much faster, because you
    - display at first cities.
    - IF user click some city then you FIND only linked streets.

You see? 
You do much less of work!!!!


> Hi Ruslan and list,
> 
> I have the impression that it is not easy to use the API when we want to
> obtain sorts of temporary tables (consisted of fields of several linked
> tables). It is maybe because I still thinks in term of SQL.
> 
> For example, always with my tables of zip / city and streets.
> 
> I have a datagrid which has to display in the opening of the window a list
> with three columns. First column: zip (table ZipCity) The second column: city
> (table ZipCity) The third column: street (table Streets)
> 
> It has to display all the streets with the zip beginning with 75. The list
> must be sorted out by zip, city, street.
> 
> Ex: 75001   PARIS   street of Kiev 75001   PARIS   street Clemenceau 75001  
> PARIS   place Vendôme 75002   PARIS   impasse of Bordeaux
> 
> The first one and the second column are thus two fields of the table
> "zip/city" The third column is a field of the table "streets".
> 
> In SQL:
> 
> SELECT zip, city, street FROM ZipCityTb, StreetTb WHERE left (zip, 2) = '75'
> ORDER by zip, city, street
> 
> We obtain then a cursor with which I can easily fill my datagrid. Especially,
> the cursor keeps a number for all the line " zip, city, street ", even if
> originally they are two different tables. It is very practical to modify
> couples " zipCity-Streets " for example, because the couple is kept in 1 line
> of the cursor.
> 
> But with the sets it is less evident because 1 set is attached to 1 single
> table.
> 
> The sets are perfected to work on a table but on any? In my example, I do not
> manage to obtain a practical code.
> 
> please, How would you make to make an equivalent of this SQL query?

-- 
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-beta mailing list