Q: What do we mean by Asynchronous query or Asynchronous DB connection?
A: Best answer, based on http://search.cpan.org/~mewp/sybperl-2.18/CTlib/CTlib.pm:
The Sybase API knows about 1) synchronous (ie blocking, the default), 2) deferred IO (polling) and 3) async IO (call-back) modes. In the synchronous mode database requests block(see below) until a response is available. In deferred IO mode database requests return immediately (with a return code of CS_PENDING), and you check for completion with the ct_poll() call. In async IO mode the API uses a completion callback to notify the application of pending data for async operations.
—– blocking ^ polling in Sybase and other databases, based on http://orafaq.com/maillist/oracle-l/2000/07/19/2071.htm:
Asynchronous connection to a database means that multiple commands can be passed to the database server and processed simultaneously. For example, there is no need to wait for the query to return before sending another command to the database server.
Instead of waiting for a “Finished” message to be sent back from the database server, the calling application sends a query status message to the database server at set times asking “Are you done yet?” (polling) When the database server says “Yes”, the result packets start coming back.
Client can send 2 signals to server
* a periodic status check — “my query is completed and ready for download?”
* a cancel
—– polling ^ call-back, based on http://search.cpan.org/~mewp/sybperl-2.18/CTlib/CTlib.pm:
To enable fully async mode, you need to have your completion callback Perl-subroutine registered, and you need to also enable async notifications, as well as setting up a timeout for requests.
Your completion callback perl-subroutine is either invoked when ct_poll() is notified of a request completion, or by the OpenClient API directly in full async mode.