Architectural Overview
In the DB Interface Module, you can choose either asynchronous or synchronous behavior at the time you connect to a database. The member function RWDBDatabase::connection() produces synchronous or asynchronous connections depending on the parameter you supply. To establish an asynchronous connection, you invoke RWDBDatabase::connection() using RWDBConnection::Asynchronous as its parameter. Synchronous connections are the default, but you can specify a synchronous connection explicitly using RWDBConnection::Synchronous in place of the asynchronous parameter.
Asynchronous Calls in the DB Interface Module lists the potentially asynchronous functions in the DB Interface Module. These functions can behave asynchronously when executed using an asynchronous
RWDBConnection, or synchronously using an explicit synchronous connection or the default.
When a function is executed asynchronously, it immediately returns to the caller with a
Future object, an incomplete DB Interface Module class such as
RWDBResult. The type of the returned object is the same for both asynchronous and synchronous functions; however, the state of the object is set to
notReady for asynchronous executions. This
Future object will come into being or
ready state later, typically after completion of the asynchronous call.
Handling C++ Datatype Returns from an Asynchronous Call explains how to handle asynchronous calls when the object returned by an asynchronous function is a C++ datatype instead of a DB Interface Module datatype.