Re: Unknown SQL
Date: Sat, 21 Jul 2001 23:27:00 GMT
Message-ID: <9f3e7u$hc7$01$1_at_news.t-online.com>
Vadim Tropashko wrote:
> Which prompts a natural question "how easy are aggregate/group by queries
in
> object querying"? Last time your example with car and wheels gave us some
> flavour what object querying is. How about
>
> select sum(sal) from emp group by dept
Hi Vadim,
this is a very simple and good example where a flat, textual representation of data seems to beat objects. I wonder why none of the other gurus here has come up with the question yet.
An instant approach for the current API: sum() and groupBy() would be methods in the Query interface. The resultset (ObjectSet) would contain objects of the class sal (Integer or Double I suppose). This example could still be evaluated within the database engine without the instantiation of objects, so it would be performant.
Now lets make it more complex:
select sum(sal), dept from emp group by dept
Here your resultset would contain Objects of the class Object[] (object
array).
Object[0] would contain the sum.
Object[1] would contain dept.
Does this sound feasible?
Thanks a lot for the comment.
Kind regards,
Carl
--- Carl Rosenberger db4o - database for objects - http://www.db4o.comReceived on Sun Jul 22 2001 - 01:27:00 CEST