On Friday 15 March 2002 09:50 am, Magnus Lie Hetland wrote:
> I wouldn't dream of using a 10 character string in the first place.
> I'd use a foreign key, probably using an id (int). That would go for
> any object references.
>
> >�Prehaps this is something
> >�that "foreign keys" in Postgres could help indicate. I'm not that
> >�familar with them.
>
> That's what I'd do, yes. (I find them indispensible; I guess you can
> easily use that sort of thing in e.g. MySQL too, just without the
> consistency checking.)
>
> Basically:
>
> � sql database
> � � � � table Department
> � � � � � � � � id integer (serial)
> � � � � � � � � code char(10) # Possibly redundant...
> � � � � � � � � name char(100)
>
> � � � � table Employee
> � � � � � � � � dept_id int (foreign key pointing to Department)
> � � � � � � � � name char(100)
> � � � � � � � � salary float
>
> I guess foreign keys aren't really necessary either -- any column
> named foo_id could be interpreted as an object reference to an object
> of class Foo (stored in the table foo), where every object reference
> is represented as an integer ID.
>
> >�Other ORMs that support existing databases still end up providing
> > for explicit configuration in order to handle object references,
> > lists, implicit joins for those things and other things.
>
> �
> I don't think I'd need it for my application. (And, btw, Postgres
> supports array columns, so I could even store lists directly...
> Though putting them in a separate table wouldn't be that hard, I
> think. Again, naming conventions could help out.)
Okay, so you're not necessarily supporting legacy databases (something
MK doesn't do well and I thought you might be aiming for). Next
question: How do you handle inheritance?
Worker (abstract)
Employee
Manager
Contractor
Does each class get its own whole table? Or do all Workers go in the
same table? Or does each class get its own table only with its
additional attributes?
How is a reference to a Worker stored in the db?
As the original author of MiddleKit, I'm all too familiar with these
issues. :-)
-Chuck
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss