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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asynchronous SQLEXEC in VFP8!

Status
Not open for further replies.

ivl

Programmer
Joined
May 16, 2003
Messages
3
Location
UA
My code:
--------------
DBdiscr = SQLCONNECT("ORA", "usr", "pass")
mySQLQueue = 'select ...'
liTMP=SQLSETPROP(DBdiscr,'Asynchronous',.T.)
liTMP=SQLGETPROP(DBdiscr,'Asynchronous',.T.)
liTMP=SQLEXEC(DBdiscr, mySQLQueue, "MyCurs")
Do while SQLEXEC(DBdiscr) = 0
WAIT TIMEOUT 5
ENDDO
SQLDISCONNECT(DBdiscr)
--------------
Problem: sqlexec return 1, DO WHILE ... ENDDO no run
In VFP7 - all right!
Why? VFP8 bug?
 
I don't have much experience with asynchronous SQL queries, however:

What is the last value assigned to "liTMP" (the first call to SQLExec)? That might give a clue as to what's happening.
 
liTMP=SQLEXEC(DBdiscr, mySQLQueue, "MyCurs")
liTMP = 1.
I receive all data at once, not on pieces. Function does not stop and does not return with zero.
 
I don't have much experience with asynchronous either, but I think you must call SQLMoreResults(), cos you are using Asynchronous Non-Batch.

Look for that command in VFP help

-- AirCon --
 
I tried it, but SQLMoreResult obtains all data at once.
It would be desirable to use that code which in VFP7 works.
 
Ahh.. I am sorry. By default it always execute in batch mode. So try to set it to non-batch. Hope it works

Good luck.

-- AirCon --
 
ivl,

Not sure about that WAIT TIMEOUT. That would seem to defeat the object of ansync. processing.

Here is some code from my courseware. Try adapting it to your situation:

lnConn = SQLCONNECT(’chip’)
SQLSETPROP(lnConn,’Asynchronous’,.T.)
lcCommand = ’SELECT * FROM BigTable’
DO WHILE .T.
lnReply = ;
SQLEXEC(nConn,lcCommand,’csrResult’)
DO CASE
CASE lnReply = 0
* query is still running
* perform some other processing here
* (eg, display a progress message)
CASE lnReply < 0
* error
MESSAGEBOX ;
(’Unable to retrieve data from server’)
EXIT
CASE lnReply > 0
* query has finished
EXIT
ENDCASE
ENDDO

Hope this is of some help.

Mike


Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top