[FAQ] How to avoid this vObjectPtr error

Ruslan Zasukhin sunshine at public.kherson.ua
Thu May 20 09:52:00 CDT 2004


On 5/20/04 1:32 AM, "Juergen Schreck" <lists at innernine.com> wrote:

Hi Juergen, 

> I just ran into a snag with V4RB 1.10. I'm creating a database with two
> tables, where the second table links to the first via vObjectPtr.
> 
> When that database was created no errors were reported.

I think that IF you open db in VAPP now, you will see problems right now.

> When records and related records were added, no errors were reported.
> 
> However, when I opened the database in Valentina.app I did not have the
> relation working. In table 2, there was my vObjectPtr field, but it
> didn't have a target and it wasn't set to cascade as I had specified in
> the code.
> 
> When I manually set the target all was ok. I could see the related
> records in Valentina.app.


I think that you have simply not correct code to create ObjectPtr.
Show this code please.

Check our examples how to create ObjectPtr.

NOTE: 
    Valentina allow creation of ObjectPtr which do not have target.
    This is required for complex db structures.
    but such ObjectPtr is not complete yet, and must be fixed before data
    start adding. 


> But why wasn't this relation created properly when my code created the
> database [without error]?

Because Valentina allow ObjectPtr with no target temporary.

> It took me a while to find out. Too long to
> be comfortable actually. In the end, the problem was that in my
> db-subclass's constructor I first instantiated the 'many' table and
> then the 'one' table. Switching the sequence in property assignment
> fixed the problem.

Aha, you have found problem.
 
> It does make sense, but shouldn't Valentina report an error when I try
> to assign a vObjectPtr to NULL vBaseObject? I suppose I can check for
> it in code or just simply get it right the first time :-P but some kind
> of warning would've really saved me some pain.

Well, in V4RB 2.0 we have now log.

And this log will be able show that target was not found.
This can be NOT AN ERROR.

Reading log, I hope developer will more easy to see mistake.


-- 
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