[V4MD] Object Pointers
Ruslan Zasukhin
sunshine at public.kherson.ua
Sat Aug 7 20:59:58 CDT 2004
On 8/7/04 8:28 PM, "Daniel Crowder" <daniel at monumental-i.com> wrote:
Hi Daniel,
> I'm getting ready to start a gargantuan project using Valentina in
> Director. I'm setting everything up currently and have a few questions:
>
> I have a product table, a media table and a product media link table
> that serves as a link between the two. Fairly basic relational stuff
> (I'm assuming).
yes
> Instead of using RecIDs in the link table to identify
> the media and products ( and thereby connect the products with the
> media) I was thinking of using two ObjectPtr fields instead. Correct me
> if I'm wrong, but this seems like the *IDEAL* use for ObjectPtr fields.
Yes.
Just why you say about ObjectPtr and RecID as alternative things?
They work in pair!
Product Table { RecID, ... }
Media Table { recID, .... }
LinkTable { ObjectPtr to Product, ObjectPtr to Media }
So yes in Link table you must use 2 ObjectPtr fields.
and they will use values from RecID fields of linked records.
> The thing I need a little guidance on is how to use to the objectptr.
Think about it as about SIMPLE ULONG FIELD.
In fact IT IS ulong field.
> For instance: I have record 55 in the products table - how do I define
> the ObjectPTR value for use in my link table?
Let you want link record 55 of Product, with record 79 of Media.
You do (pseudo code)
cursor = "SELECT ptr1, ptr2 FROM LinkTable WHERE recID = 0"
cursor.field( "ptr1" ) = 55
cursor.field( "ptr2" ) = 79
cursor.AddRecord()
Or you can use SQL's INSERT
db.SqlExecute( "INSERT INTO linkTable(prt1, ptr2) VALUES(55, 79) ")
> When any of the records
> are deleted from the products or media tables what is the best way to
> make sure that all records in the link table are removed? Does using
> Object Pointers here provide some built-in benefits?
Yes of course.
Just set both ObjectPtr to have CASCADE deletion.
Then Valentina will a automatically delete records in Link table.
> Any suggestions and SQL examples are welcome!
--
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://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list