[IDEA] BinaryLink that supports order !!!

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Nov 23 16:25:15 CST 2005


On 11/23/05 4:01 PM, "Jochen Peters" <j.peters at valentina-db.de> wrote:

>> Hey!
>> 
>> Yesterday I have got cool idea!
>> 
>> How to implement BinaryLink, which can keep _order_ of child records.
> Wow!
> Sounds like very unique feature.

Exactly !!!

With this we can get a lots of new methods that support ORDER of items:

Class VBianryLink
{
    // we have now:

        Link( RecID_A, recID_B )


    // we can do future:
    // LINK methods:

        LinkFirst( RecID_A, recID_B )
        LinkLast( RecID_A, recID_B )

        // Links recID_B record to RecID_A
        // and insert it AFTER specified RecID_B_Existed,
        // which already is linked to recID_A
        //    
        LinkAfter( RecID_A, recID_B, RecID_B_Existed )

        LinkBefore( RecID_A, recID_B, RecID_B_Existed )

        LinkAt( RecID_A, recID_B, IndexPosition )


    // we can do future:
    // MANAGE of items

        MoveItemUp( recIDA, recIDB )
        MoveItemDown( recIDA, recIDB )

        MoveItemUpAt( recIDA, index )
        MoveItemDownAt( recIDA, index )


    // Search methods:
 
}

Also this give ability improve SQL to do all above operations *and*
Searches of kind:

    find records of table A, which have FIRST child with such conditions....

Particular example:

    SELECT Person.*
    FROM Person parent, Person child USING Born
    WHERE FIRST child.Name = 'Peter'

To express this right now in Valentina 2 (or in mySQL, Oracle, ... )
You must self first of all provide additional column to keep order, spend
hours to write logic, then do sql as

    SELECT Person.*
    FROM Person parent, Person child JOIN parent.id = child.ptr
    WHERE child.Name = 'Peter' and child.index = 1

I underline that The main advantage is not in simpler SQL, but in hours of
work to implement order manually using additional columns.

2 months ago, I have self have meet this problem in one project. That was
half of day to make it work correctly. For only one table. Now I have task,
which have need in a lots of such Links With Order. It will be pain do all
that manually, so I have start think HOW TO ...


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina-beta mailing list