On 10/28/05 8:22 AM, "John Siracusa" <[EMAIL PROTECTED]> wrote:

> On 10/28/05 8:11 AM, Sean Davis wrote:
>> Sorry.  Re-reading, I did imply that it wasn't possible.  What I meant was
>> that one HAS to define the primary key explicitly
> 
> Well, unless the convention manager can find it, of course :)
> 
>> quite easy to do if there is such a primary key available (i.e., all rows
>> actually HAVE a primary key that is definable).
> 
> If they don't, you can't use RDBO to front that table (view, whatever).
> Recall the requirements from the docs:
> 
>   * The database server must be supported by Rose::DB.
>   * The database table must have a primary key.
>   * The primary key must not allow null values in any of its columns.
> 
> The final requirement may be relaxed one day, but the first two will not.
> 
> Well...technically, what you really "can't do" is load() and save()
> individual objects.  I suppose you could define an RDBO class for the view,
> plus a "fake" primary key (that you'll never use to do anything), then just
> use RDBO::Manager to fetch multiple objects.  You might even be able to use
> this view in a "... to many" relationship with other RDBO classes.  But
> you'll never be able to load or save an individual row in the view if
> there's no way to uniquely identify one (obviously).
> 
> Hm, so maybe a RDBO::View class that inherits form RDBO, relaxes the primary
> key requirement, and then disables load() and save()?  I'm open to
> suggestions...

If there was infinite development energy, that would be fun to see.  Views,
I think, are intrinsically different in some ways from a table.  Tables are
for storing and maintaining data integrity, but views are a convenient way
to summarize while leveraging the power of the database engine to do so
quickly.  In the latter sense, views are almost always going to be faster
than multiple queries if the query engine is smart.  Would it be possible to
design a view class that would "be" a table if the primary key was defined
but otherwise be a generic View class?  And would joins still be possible?
I would think so, as the view class would still know the column names, etc.,
but you would have to enforce that a join (in RDBO terms) is to a primary
key from another table or view so the join could only be from and not to,
correct?  Just a couple of thoughts.

Sean



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to