My error handler has recently reported two instances of the following scenario:

User causes a SQL SELECT query to run.
Suddenly, the application is being shut down via my custom main window's QueryUnload(). Normal shutdown requires access to tables that may be implicated in the SQL SELECT query.
VFP Error 3 ("File is in use") occurs.

I use a custom main window instead of the VFP _SCREEN, which is suppressed. My code calls the QueryUnload() of child windows at times, but it NEVER calls the MainWindow.QueryUnload(). So the only way that method can be called is via the user pressing the "x" (close) button or the upper-left icon for the window popup menu, or if the window still exists when CLEAR WINDOWS, RELEASE WINDOWS, or QUIT is issued. Of those three, only CLEAR WINDOWS appears in my code, after everything related to databases and tables is done. In fact, it only occurs after the shutdown code issues CLOSE DATABASES ALL.

The query expressions are assembled by different methods of different objects under different circumstances, but the code that executes them resides in a single method of my query object. That object is instanciated separately in each of these cases.

In one of these cases, the user starts the query in a modal child window, and therefore should not be able to click the "x" close button or the upper-left-corner popup-menu button to trigger QueryUnload(). So that's another headache.

But in the other case the window in which the user starts the query is not modal.

There are other anomalies. For example, in one of these instances there is NO error-handler in the stack trace. That is, no line for any object's Error() method and no line for my error-handler program. However, my messaging object's code for logging errors and emailing the log file gets triggered, and announces VFP Error 3, so it must have occurred. But the trace jumps from the method where the query is actually executed directly to the messaging object without any intervening error-handling code.

Question 1: Does a SQL SELECT place a lock on a VFP .dbf table such that the same user can't issue a USE on the table while the query is running?

Question 2: Insofar as possible, should I program defensively by disabling controls related to shutting down while queries are running?

Thanks again everybody.

Ken Dibble
www.stic-cil.org


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/5.2.1.1.1.20150713110142.02091...@pop-server.stny.rr.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to