I cannot seem to get an asynchronous connection to work. Am I missing 
something obvious? Despite the call to 
SQLSETPROP("Asychrounous",.T.), the SQLEXEC() locks until the entire 
result set is returned, despite finishing with a 0 return value. I've 
tried in VFP8 & 9SP1 & SP2 hitting a PostgreSQL database, with no luck.
The code below hits a table with 16,000 records. The first SQLEXEC 
call takes about 5 minutes to finish executing and returns a 0. The 
next call returns a 1 and finishes immediately. Reccount() shows 
16,000 for both calls.

What's going on? Could it be a bug specific to PostgreSQL and/or 
their ODBC driver?

CLOSE ALL
CLEAR
LOCAL lcDriver, lcServer, lcUserId, lcPassword, lcCStr, lnOption, 
lcOptionString, lcSQL

lcDriver = "PostgreSQL ANSI"
lcServer = "VXP-POSTGRES"
lcUserId = "xxx"
lcPassword = "xxx"
lcDatabase = "test"

lnOption = 0

lcOptionString = ";OPTION=" + ALLTRIM(STR(lnOption))

lcCStr = 
"DRIVER="+lcDriver+";SERVER="+lcServer+";DATABASE="+lcDatabase+";UID="+lcUserID+";PWD="+lcPassword+";B9=0"
lcCStr = lcCStr + lcOptionString
?lcCStr

nHandle = SQLSTRINGCONNECT(lcCStr)
?"Set Asycn Mode"
??SQLSETPROP(nHandle,"Asynchronous",.T.)
lcSQL = "SELECT * FROM email ORDER BY sent"
?lcSQL
?"First Call:"
??SQLEXEC(nHandle,lcSQL,"csrTest")
?"Rec Count:"
?RECCOUNT("csrTest")
?"Second Call:"
??SQLEXEC(nHandle,lcSQL,"csrTest")
?"Rec Count:"
??RECCOUNT("csrTest")



_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** 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