Object Pointer Question
Ruslan Zasukhin
sunshine at public.kherson.ua
Tue Feb 11 21:33:28 CST 2003
on 2/11/03 9:08 PM, Gordon Apple at ga at ed4u.com wrote:
Hi Gordon,
> I'm not totally clear on how object pointers work. They apparently store
> the RecID of the pointed-to object. Do they also store the table pointer in
> each record? Or is that only stored in the base object?
>
> The real question is whether or not an object pointer field (column) can
> contain pointers to more than one table. I'm trying to avoid the
> inheritance question here and simply see if my object pointers can point to
> records in different tables.
ObjectPtr cannot do this.
> For example, I might have a table of people and two additional related tables
> of attributes.
>
> The pointed-to attribute record (owned by the people table record) might be
> different for men and women. The male attributes table might have parameters
> to describe business contacts. The female attributes table might have a
> hot-lips rating. (OK, I know it's sexist. It's just an example.) I'd like
> to have one object pointer in the people table that would point to a record in
> the appropriate attributes table depending on what's in the people record
> male/female column. Is that possible?
Gordon, again no. With ObjectPtr no.
But example that you describe must be solved in reverse way!
You simply need put ObjectPtr to both attributes tables.
If to speak in inheritance way:
Person
|--- man
|--- woman
Inheritance require 1 : 1 relation, so you need make ObjectPtr to be Unique.
And this is all!
Agree?
Actually ObjectPtr was invented in Valentina to implement INHERITANCE.
Simply Valentina will automatically add this hidden ObjectPtr field when you
will say
CREATE TABLE Man INHERITED FROM (Person)
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list