main logo
Subject: Re: Collection Object
Author: =?ISO-8859-1?Q?Philip_M=F6tteli?=
Posted: 2006/07/31 11:33:28
 
View Entire Thread
New Search


Am 31.07.2006 um 18:10 schrieb Ruslan Zasukhin:

> On 7/31/06 5:58 PM, "Philip M=F6tteli" =20
> <philip.moetteli .AT. econophone .D.O.T ch> wrote:
>
>>> Can you make more details on this?
>>
>> As we found out, the normal use of a DBMS from an OO-program consi=
sts
>> of referencing records/objects. For this application an OODBMS is
>> much better suited. But NSArray/NSMutableArray also offers these
>> methods:
>>
>> - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate
>>
>> - (void)filterUsingPredicate:(NSPredicate *)predicate
>>
>>
>> These methods actually access the internals/IVars/fields of the
>> member objects/records.
>
>> We could achieve a huge performance acceleration, if, instead of
>> deserializing all the member objects/records into RAM and applying
>> the predicate/query there, we let do this on the DBMS side.

>
>> So the NSPredicate would produce some SQL output, which would be s=
ent
>> to the server, which would apply an SQL statement like this to the
>> collection table (NSSet,=85)(I'm not an SQL expert!):
>>
>> SELECT *
>> FROM NSSet
>> WHERE a.x =3D y;
>>
>> And we would deserialize only the resulting OIDs.
>
> Lets on example:
>
> Table TC have next records with arrays, I will use simple values =
=20
> for OIDs to
> simplify
>
> Table NSSet
> -------------------------------------------------
> RecID f1 f2 f3 - Array
> 1 4 sdf { 2, 3, 7, 9, 12 }
> 2 8 dfgd { 3, 8, 10, 15 }
> 3 2 fhgf { 4, 7, 11, 13, 24, 32, 45, 68 }
>
> Now we do SQL query
>
> SELECT RecID
> FROM NSSet
> WHERE f3.contains( 7 )
>
> Result - cursor on table NSSet with 2 records with RecIds of NSSet
>
> ------------
> cursor RecID
> -------------
> 1
> 3

This type of query should never happen.


> Also we can want do
>
> SELECT RecID, f3
> FROM NSSet
> WHERE f3.contains( 7 )
>
> ---------------------------------------------
> cursor RecID f3
> ----------------------------------------------
> 1 { 2, 3, 7, 9, 12 }
> 3 { 4, 7, 11, 13, 24, 32, 45, 68 }
>
> Or you think about something else?

Two cases:

1.)=09SELECT RecID
=09FROM NSSet
=09WHERE RecID=3D1 AND f3.contains(7)

=09This would merely return a BOOL.


2.)=09SELECT f3
=09FROM NSSet
=09WHERE RecID=3D1 AND f3.*.name=3D'Ruslan'

Actually searching in the records referenced by the OIDs in f3.


> AS RESULT of search we must find NSSet instances, right ?

In case 2: Yes. In case 1: NO, just a BOOL.


Re
Phil

_______________________________________________
Valentina mailing list
Valentina@lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina

 
©2006 =?ISO-8859-1?Q?Philip_M=F6tteli?=
<-- Prior Message New Search Next Message -->