Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible cSelect Bug - Read This One
Message
From
07/10/2003 17:47:57
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Possible cSelect Bug - Read This One
Miscellaneous
Thread ID:
00835978
Message ID:
00835978
Views:
47
Sorry about the other messages - hit tab in the code snippet an IE went nuts on me...

A while back I reported a possible problem with the cSelect object. I had since decided to abandon using it - it was convenient, but I was getting unexplainable behavior that would go away when I just uses two lines of code instead of the one that cSelect offers (i.e. lnArea=select()/select(lnArea)).

I have now come up against the problem in a framework class. Specifically, when the application object instantiates, it runs the addchildren method. The last method called in that calling chain is cDatabaseMgr.MetaData.SelectDefaultDatabaseRecord(). That method has compilation directives which instruct VFP to use the NewObj() function instead of CreateObj() to create cSelect, depending on the version of VFP.

All of a sudden, I am getting bugs when that particular method runs. The cSelect method does not instantiate. In fact, the init method does not even run. I have placed debugouts in the cSelect's init method which shows the callstack for every single instantiation, and not once in the output file is there a reference to the SelectDefaultDatabaseRecord() method.

The problem disappears if CreateObj() is called instead of newobj. In other words, if I remove the compilation directive (or whatever it's called), changing the code from:
#IF VFP_VERSION >= 6
          loSelect = NEWOBJ('CSelect', 'CUtils', '', 'MetaDBC')
#IF .f.

#ELSE
	loSelect = CREATEOBJ('CSelect', 'MetaDBC')
#ENDIF
to
loSelect = CREATEOBJ('CSelect', 'MetaDBC')
The problem disappears.

I'm not sure if this warrants a change to the framework, since the problem is not reproducable in other circumstances, but it obviously presents problems in that I need to change the code of a framework baseclass. Why use NewObj() at all, though? I don't see the benefit, since the classlibs are already set.

No response is necessary. I write this to add to the MM Knowledge Base for future reference.
Reply
Map
View

Click here to load this message in the networking platform