On all platforms except VMS, DB-Library provides limited support for “non-blocking reads,” using the calls dbrpcsend, dbsqlsend, dbpoll, and dbsqlok. Following is the typical calling sequence:
dbrpcsend or dbsqlsend – sends the RPC or language command and return immediately.
dbpoll – is called in a loop until the return_reason parameter is set to DBRESULT. (Windows DB-Library 4.2 applications use the routine dbdataready instead of dbpoll.)
dbsqlok – retrieves the initial results from the command.
With DB-Library, only the initial read of the command’s results is asynchronous. The application must poll for the arrival of the initial results—if the initial results are not available when dbsqlok is called, dbsqlok blocks. After dbsqlok, subsequent calls to dbresults and dbnextrow are synchronous.
On VMS, DB-Library provides the asynchronous routines dbopen_a, dbsqlexec_a, dbsqlok_a, dbresults_a, and dbnextrow_a. Applications that use these routines can be converted to use Client-Library’s fully asynchronous programming model, which is discussed next.