Allows you to perform asynchronous operations on your database in PocketBuilder. In other words, if you have coded a RetrieveRow event for a DataWindow object, before the current database retrieval operation completes, you can cancel it or start another (non-database) operation that does not use the same database connection. You can also switch to another Windows process while the retrieval takes place.
By default, PocketBuilder operates synchronously.
ODBC
Async = value
Parameter |
Description |
---|---|
value |
A value specifying synchronous or asynchronous operation. Values are: |
Async = 0
Enabling asynchronous operation in PocketBuilder is useful when you are executing a complex SQL statement that takes several minutes to return results. If the Async parameter is set to 1, you can do either of the following while the SQL statement is executing:
Work in another window
Cancel the statement before it retrieves the first row of data
When to set Async If you are communicating with the database in a PocketBuilder script, you can reset the Async value at any time before or after the Transaction object has connected to the database.
How data is retrieved When you retrieve data in a DataWindow object, the following steps occur in order:
The database server compiles and executes the SQL statement.
PocketBuilder retrieves (fetches) the first row of data.
PocketBuilder retrieves each subsequent row of data.
What happens before the first row is retrieved While the server is compiling and executing the SQL statement and before PocketBuilder retrieves the first row of data, you need to have done both of the following to enable asynchronous operation (allowing you to cancel the current operation before it retrieves the first row of data):
Coded a RetrieveRow event for the DataWindow object (the code can contain only a comment)
Set the Async DBParm parameter to 1
What happens after the first row is retrieved After the first row of data is retrieved and between subsequent row fetches, you need to have done only the following to enable asynchronous operation:
Coded a RetrieveRow event for the DataWindow object
After the first row is retrieved, PocketBuilder operates asynchronously without your having to set the Async DBParm to 1, so you can cancel the current operation anytime after it retrieves the first row of data. Therefore, the Async DBParm parameter has no effect in PocketBuilder after the first row of data is retrieved.
To enable asynchronous operation:
Database profile Select the Asynchronous check box on the Transaction tab in the Database Profile Setup dialog box.
PocketBuilder application script Type the following in a PocketBuilder script:
SQLCA.dbParm = "Async = 1"
You can set the Async and DBGetTime parameters in a single DBParm statement. DBGetTime specifies the number of seconds you want PocketBuilder to wait for a response from the DBMS when you retrieve rows in a DataWindow object.
To enable asynchronous operation and set the DBGetTime parameter to 20 seconds:
Database profile Select the Asynchronous check box and type 20 in the Number Of Seconds To Wait box on the Transaction tab in the Database Profile Setup dialog box.
PocketBuilder application script Type the following in a PocketBuilder application script:
SQLCA.dbParm = "Async = 1, DBGetTime = 20"