West Wind Internet and Client Tools
wwSQL - using asynchronous mode
Hi Rick
How to use wwsql::Execute in a query with a big table, in asynchronous mode?
using native SPT it worked:
= SQLSetprop (m.pnSQLHandle, "Asynchronous",. T.)
lnResult = 0
Do While lnResult = 0
lnResult = SQLExec (m.pnSQLHandle, lcSQLCmd, "curDados")
DoEvents
Enddo
If lnResult <0
SQLCancel (m.pnSQLHandle)
Endif
= SQLSetprop (m.pnSQLHandle, "Asynchronous",. F.)
Thank you
Adriano Brunes
You can specify the llAsync
in the Connect()
method or explicitly use SetAsyncMode(.T.)
.
Result data should work the same as wwSql returns the SQLEXEC() result for most operations (Execute
and ExecuteNonQuery
).
Frankly though there's not much benefit to using Async with wwSql over raw SPT so if you're making async SPT calls it might be cleaner to just use wwSQL to make the connection, then just use the loSql.nSqlHandle
in a SQLEXEC()
call to make a raw SPT call with the Async operation.
+++ Rick ---