West Wind Internet and Client Tools
wwSQL - using asynchronous mode
Gravatar is a globally recognized avatar based on your email address. wwSQL - using asynchronous mode
  Adriano
  All
  May 11, 2020 @ 08:07am

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

Gravatar is a globally recognized avatar based on your email address. re: wwSQL - using asynchronous mode
  Rick Strahl
  Adriano
  May 11, 2020 @ 02:39pm

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.

wwSql::Connect()

+++ Rick ---

© 1996-2020