Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding ASTACKINFO
Message
 
 
To
24/04/2022 15:42:32
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01684243
Message ID:
01684251
Views:
24
>>>If you can use a debugger, set a watch expression on SELECT("Main_Cursor") and put a Set Step On in form's .load(), then it should stop twice: once the cursor is created (it would show a non-zero value) and next when it's closed (becomes zero).
>>
>>Unfortunately, I tried this approach. And I never get the cursor closed on my system, during testing.
>>This happens to some customers. And mostly in a couple of methods where the code "determines" that the cursor is closed. So the cursor gets closed in a method before the one where the error occurs.
>>I will have to place many test codes - checking if the cursor is closed - at design time. And maybe this will catch the problem. I suspect, but I can't prove, that the cursor is closed because something happens to the desktop.
>>Although I don't know for sure.
>
>A few general things to consider:
>
>- If you're using multiple datasessions, are you unexpectedly switching between them?
>- Are you implicitly closing your table by opening another one in its work area - maybe you're forgetting an "... IN 0" clause in a USE command or something similar?
>- Are users selecting an unexpected work area by clicking on a grid or some other control?
>
>I use defensive coding like this when opening tables, running SELECTs or doing other data munging:
>
>FUNCTION MyFunc
>LPARAMETERS ...
>
>LOCAL lnSelect
>lnSelect = SELECT( 0 )
>
>* Data munging goes here...
>
>SELECT ( lnSelect )
>
>RETURN
>
>Another defensive technique is to ensure a table is open before doing anything which requires it - if not, open it. This doesn't pinpoint why a table is being closed unexpectedly but minimizes the impact of that happening.

I do not use datasessions. I do not open tables. Everything I do is based on the Cursor Adapter (CA). I have my own biz object, for each table in the application. So, on any particular form, at design time, I drop the biz objects of each table.
And the CA automatically opens the CA view/cursor for each table. These views are open for the life of the form.
And I do have a "defensive" code now that checks if the main CA view is open; in certain places. And if it is not open, the code write the error in a hidden LOG. Then periodically I check this log. For most customers I never see anything in this LOG. But a few, on occasion, have entries in this LOG. Sometimes, once a month, or once in a 6 months. No reasonable explanation.
And I keep adding these "defensive" checks if the CA view is open. But when I checked the log of a few customers (just today), they show that the CA view/cursor was not open in certain places. But I don't see how the view was closed. This is what I am trying to determine.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform