The sqldone() function

The sqldone() function determines whether the database server is currently processing an SQL request.

Syntax

mint sqldone();

Usage

Use sqldone() to test the status of the database server in the following situations:
  • Before a call to the sqlbreak() function to determine if the database server is processing an SQL request.
  • In a signal-handler function, before a call to the longjmp() system function. Only use longjmp() in a signal-handler function if sqldone() returns zero (the database server is idle).

When the sqldone() function determines that the database server is not currently processing an SQL request, you can assume that the database server does not begin any other processing until your application issues its next request.

You might want to create a defined constant for the -439 value to make your code more readable. For example, the following code fragment creates the SERVER_BUSY constant and then uses it to test the sqldone() return status:
#define SERVER_BUSY -439

⋮

if (sqldone() == SERVER_BUSY)

Return codes

0
The database server is not currently processing an SQL request: it is idle.
-439
The database server is currently processing an SQL request.