Questions inserting records with object pointers.

Fred.Stephenson Fred.Stephenson at communication-unltd.com
Mon Nov 3 19:23:09 CST 2003


>I've got my schemas built (I believe), and I'm able to review them, and
>they look okay. But I haven't figured out how to deal with tables that are
>connected by object pointers.
>
>Let's say that I have three tables:
>
>1) Employees
>2) Departments
>and 3) Dept_Emp which is used to resolve the many-to-many relationship
>between employees and departments. Dept_Emp will have two fields in it,
>ptrEmployee and ptrDepartment.
>
>Now, let's say that I want to assign some employees to teams.

You mean departments??

>What will
>the SQL be for that? I was thinking that I would have to
>   1) Retrieve the RecordID for the Employee and assign it to an integer
>variable (in RB);
>   2) Retrieve the RecordID for the dept and assign it to an integer.
>   3) Write a SQL statement to do an Insert with the two pointers.
>

Well I reckon I may be about to receive a lesson but here's how I do 
it at the moment

D_Ecurs.setblank
D_Ecurs.field("EPtr").setstring(Ecurs.field("recid").getstring)
D_Ecurs.field("DPtr").setstring(Dcurs.field("recid").getstring)
if not D_Ecurs.add then
if Db.errNumber <> 344 then
// error sequence here
end if
end if

>But that seems to go against the idea behind the Valentina model; I feel
>like I'm trying to manipulate data that Valentina wants to manage itself.
>Am I really on the right track, or is there an easier, recommended way?

So basically I'm doing it your way too...
>
>I didn't find anything in the V4RBReference.

Have you looked in the examples??

all the best

Fred
>_______________________________________________
>Valentina mailing list
>Valentina at lists.macserve.net
>http://lists.macserve.net/mailman/listinfo/valentina



More information about the Valentina mailing list