Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Results of SQL Select effected by another DataSession
Message
From
19/04/2005 03:54:48
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01006023
Message ID:
01006080
Views:
19
>My app has two forms open at the same time, each with a private data session. All data is being obtained from a VFP table in the database which resides on another computer across the network. Form "A" references a local view based on table "MYTABLE" with 10 records (VFP has MYTABLE open in that datasession even though I did not explicetly open it). If, after form "A" is open, another computer on the network adds an additional record to MYTABLE, the actual database table will have 11 records (confirmed). When form "B" executes an SQL-Select (select * from MYTABLE) the result set of the select will contain only 10 records. If I close form "A" and redo the SQL Select the result is now 11 records as it should be.
>
>So the SQL-Select in the private datasession of form "B" seems to be limited or influenced by the base table open in the private datasession of form "A". The buffer mode for both forms A & B = 0 (none) however the buffering for the local view in Form A is optamistic-table.
>
>I have tried altering SET REFERSH TO but can't seem to get that SQL Select to return the proper number of records as long as form "A" has that table open in its private datasession. Is SET REFRESH scoped to a data session or is it global?
>
>Does anyone have any suggestions on how to resolve this issue? I should be able to do a SQL Select from a form's with a private datasession and get the results from the DBF regardless of what is going on in another private datasession.
>I must be missing something here....
>
>Thanks

Hi Alec,

yes, VFP open 1 and only 1 file handle for every table opened on the application;
when you do the second SQL select, VFP read buffered data without check file system status.
On VFP9 you can disable it ( i don't test as work ) with:
SET REFRESH TO 0,-1 && Global setting
* or clear the tables's buffer
* then: on Datasession B
USE MYTABLE ...ALIAS MYTABLE
SYS(1104,"MYTABLE")  && CLEAR myTable buffer ( it is one only on the application )
SELECT * FROM MYTABLE ...
On VFP8, try:
SYS(1104) && clear all buffers
SELECT ... FROM MYTABLE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform