From: Tim Bates Date: 2004-01-08T15:00:55+09:00 Subject: Re: Database applications and OOness On Wed, Jan 07, 2004 at 10:16:42PM +0900, Martin DeMello wrote: > > This really returns a salesperson-to-integer mapping of how many > > customers a salesperson has dealt with. You can't represent this as a > > plain list of objects, unless you created a special type of object just > > for it (which is silly) and most OO-type database libraries won't let > > you make that sort of query at all without going behind their backs, > > which is really ugly. > > What would you like it to return? Should it construct a class on the fly, > with fields 'name' and 'customers'? And should it use its own query > language to do so, or parse the sql query? I don't know. Probably an array of arrays or an array of hashes - which, I know, is exactly what DBI would return for such a query. The point I'm trying to make is I'd like the system to be able to handle this sort of query _as_well_as_ the "SELECT * FROM table WHERE property = ?" type return-a-list-of-objects query. I don't know of any system that can do that, or even if it could be done neatly. Possibly such a system would have to accept two sorts of query and handle both separately, but that introduces its own ugliness. Tim Bates -- tim@bates.id.au