Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sesssion Class
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00222980
Message ID:
00233607
Views:
33
>I know the problem is probably with the Docs, but using the Session class to create a default data session does not make sense to me. A default DS is created when VFP or a VFP app launches. Why would I create something I already have? I would think by definition that Session means a new, and therefore private, DS.
>
>I have already made good use of this class in setting up a private DS for my MAIN.PRG for setup work. That way I do not have to step on anything in DS 1 that I want generally available.

On the same subject (well, sort of), here's a "gotcha" I ran into.

I like to write code generators that base the code on the data from the various VFP metadata files. I just recently finished writing a DE extractor (yeah, I know there are a couple here, but I learn more this way), with the idea of linking it up to a session object. Writing the generator and the session object to use the generated code wasn't tough. Anyway, I'd been playing around with the results and decided to see if I could hook it up with an existing form that had the dataenvironment stripped out. When I used the DE I had generated with the form, I started getting errors telling me that buffering was required.

So I looked at the code to check to make sure that it had been generated properly. The InitialSelectedAlias was right (and in fact was current when the error occurred), and, sure enough, the BufferModeOverride was set to 5 for the cursor object.

Figuring something in the form might be doing it, I generated the session object without the form, and checked CURSORGETPROP() to see if it was right. It wasn't, it was set to 1. Back I went to staring at the code.

I noted, both from the code and the metadata, that CursorSource property appeared (and was initialized) after the BufferModeOverride property. On a hunch, in the code I physically moved the CursorSource ahead of the BufferModeOverride property, and tried again. This time everything worked just fine and the property was set correctly.

I don't know if this effects anything prior to VFP 6.0 SP3, but apparently, in this version, the order that some of the properties in a cursor object are initialized is significant.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform