Re: Outer Join Question
Re: Outer Join Question
- Subject: Re: Outer Join Question
- From: email@hidden
- Date: Thu, 8 May 2003 10:00:18 -0400
I tried using a qualifier with services.abailability = nil, but this
generated faulty SQL that actually looks for availabilities whose
primary key is nil!
I don't want to do the filtering in memory because this solution does
not scale up. When the number of restaurants increase, creating
EOEnterpriseObjects for all them will take time and overload memory as
well.
After much searching in WebObjects doc and OpenBase doc. I have found
the way to do that using raw SQL, but I'd prefer to keep database
independance if possible. So I came up to the Outer Left Join thing.
However, I am not very familiar with SQL. It looks like SQL is
generated OK by WO, but for some reason I don't understand it does not
do what I was expecting.
Serge
Le lundi, 5 mai 2003, ` 16:20 America/Montreal, Ricardo Strausz a icrit
:
> In pseudo code, the kind of SQL you need is:
> select * from Restaurant where restaurantOpen AND (seatsAvailables OR
> services.availability = nil)
>
> The "ease" way is to do it via RawSQL, but you may need to know a bit
> more of SQL.
>
> Other way to do it, is by code; set a usual inner relations S->R and
> R->>A.
>
> Fetch those Services with restaurantOpen like qualifier. (this most
> bring you 2 restaurants, but via the to-one relation)
> go thru all of them performing something like:
> while(not(services.restaurant.availability) OR
> (services.restaurant.availability.date = THEDATE AND
> services.restaurant.availability.seatCount >= THESEATS))
> services.restaurant.addToListOfGodies();
>
> You rarely will nead something else from Inner relations...
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.