Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHERE IS THE CURSOR?

Status
Not open for further replies.

pxw

Programmer
Jan 6, 2002
86
0
0
AU
I have a VFP app in a NT server. The app is shared by a number of PCs with a mapped network driver. Some of the PCs are located thousands KM away physically. Followings are two SQL statements of the app called by a user from a PC:

select * from stock where state="WA" into cursor ctemp1 nofilter
select sum(purchasecost) from ctemp1 into cursor ctemp2

My questions are,
1. where is the cursor ctemp1, in the NT server or the location PC?
2. the data process, the second statement, occurs in the NT server or the location PC.

Any helps would be greatly appreciated.


Peter
 
All the processing is done on the local PC. The cursors are created on the local PC. The server is merely file storage.

Clayton
 
hi Claytoon,
Thanks for your advice. You mentioned that "all the processing is done on the local PC". It means the server sends the required information to the local PC to form a cursor? If so. how can the server understands what type of information should be sent? In my case, please note that all the SQL statements and tables are on the server. Nothing is on the local PC. I want to understand your points more clearly.



Peter
 
If you are talking VFP SQL statements, this is done by the app scanning through the file or files located on the server and if it finds a record that matches the criteria, it reads it and writes it to another temporary file. This file is located on the pc wherever the TEMP directory is defined, unless you have set TEMP to be a network drive.
If you are talking about MS SQL or Oracle, the app sends a request to the SQL engine running on the server, the server gathers up the data matching the criteria and sends it back to the pc. The pc once again, places the data in a temporary file wherever the TEMP is set.

Dave S.
 
Dave and Peter,
If there is a TMPFILES entry in your CONFIG.FPW, then this takes precedence for exactly where VFP temporary files are created.

Rick
 
Hi All,
Many thanks for your advice. What I want is to minimize the network traffic. Now I understand clearly the temporary files can be stored in the server.

Dave, I am using VFP SQL statements.

Rich, should the CONFIG.FPW be set up for the local PCs individually? Is there any problems if all the users use the same TEMP directory in the NT server?


Peter



 
If you REALLY want to minimize the network traffic, you can change the program so that it sends the SELECT statements through ODBC to the server, and the cursors will be created on the server and all processing will happen there.

This will only work easily if ALL data access is through SQL commands (SELECT, UPDATE, DELETE WHERE, etc.)
Most likely, since it's not designed now to use ODBC, this wouldn't be a quick conversion.

Plus, you can get a cursor from the server to be sent locally rather than created on the server by not specifying an INTO clause on the SQL command.

VFP could be the backend on the server, or Sql Server, or MySql (open source "free" software), but each one has slight differences in SQL syntax.
 
Hi wgcs,
I do want to minimize the network traffic. I am very interested in the ODBC approach you mentioned. I will try it shortly. The app I am working is a new system. It can be designed to use ODBC.

I like the your idea.
"get a cursor from the server to be sent locally rather than created on the server by not specifying an INTO clause on the SQL command.".
However, I have difficulties to understand it clearly. Could you please give me some further explanations?

What is the performance of VFP as the backend on the server? We are considering to get three Sql Servers. This is because my VFP app will be set up in three states. For business reasons, the users doesn't want to use one server. It will a big saving for the users if VFP can do the job properly.


Peter
 
Peter,
I normally put the CONFIG.FPW on the local system, and have it point the temp files to a local directory. To minimize network traffic, these files should be local. Since all proessing is done locally, if you keep the temp files on the network, you'll at least double the network traffic required. Also, if all users keep their temporary files in the same directory on the network, the file server will incur that much more work, and depending on the server's disk configuration, this can also slow down processing and introduce potential file name conflicts.

Rick
 
What is critical for using FOXPRO as a file server - that is, have a fat client and just the DBF's are stored on the server is to know exactly what tables will be stored on the server and what can be copied locally. Foxpro has a great engine so you can decide where to store tables to minimize network traffic.

Large tables can be pigs on a network but if you use focused SQL Select statements (unlike your generic example SELECT * from file where state = 'WA' NOFILTER), and stay away from FILTERS - which is what your NOFILTER does then you will be okay.

Place static tables on the local machine - copy them down once a day if desired.

Large tables can have large indexes - if you have a 100 meg DBF - you will be incurring network traffic just openning them. There are ways around having large files.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top