dbsqlok

Description

Wait for results from the server and verify the correctness of the instructions the server is responding to.

Syntax

RETCODE dbsqlok(dbproc)
 
DBPROCESS     *dbproc;

Parameters

dbproc

A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library uses to manage communications and data between the front end and server.

Returns

SUCCEED or FAIL.

The most common reason for failing is a SQL syntax error. dbsqlok will also fail if there are semantic errors, such as incorrect column or table names. Failure occurs if any of the commands in the batch contains a semantic or syntax error.

In addition, a runtime error, such as a database protection violation, will cause dbsqlok to fail if the command buffer contains only a single command. If the command buffer contains multiple commands, a runtime error will not cause dbsqlok to fail. Instead, failure will occur with the dbresults call that processes the command causing the runtime error.

The situation is a bit more complicated for runtime errors and stored procedures. A runtime error on an execute command may cause dbsqlok to fail, in accordance with the rule given in the previous paragraph. A runtime error on a statement inside a stored procedure will not cause dbsqlok to fail, however. For example, if the stored procedure contains an insert statement and the user does not have insert permission on the database table, the insert statement will fail, but dbsqlok will still return SUCCEED. To check for runtime errors inside stored procedures, use the dbretstatus routine to look at the procedure’s return status and trap relevant server messages inside your message handler.

Usage


Using dbsqlok with dbsqlsend


Using dbsqlok with dbrpcsend


Using dbsqlok with dbwritetext and dbmoretext

See also

dbcmd, dbfcmd, DBIORDESC, DBIOWDESC, dbmoretext, dbnextrow, dbpoll, DBRBUF, dbresults, dbretstatus, dbrpcsend, dbsettime, dbsqlexec, dbsqlsend, dbwritetext