dbsqlok

DB Library for C

DB Library for C

dbsqlok

Verifies the correctness of a command batch.

Syntax

RETCODE dbsqlok ( PDBPROCESS dbproc );

Arguments

dbproc

Is the DBPROCESS structure that is the handle for a particular workstation or Microsoft® SQL Server™ 2000 process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.

Returns

SUCCEED or FAIL. The most common reason for failing is a Transact-SQL syntax error.

Remarks

dbsqlok following dbsqlsend is the equivalent of dbsqlexec. This function must be called after dbsqlsend returns SUCCEED. When dbsqlok returns, then dbresults can be called to process the results. In a batch, if the last statement fails, then dbsqlok returns FAIL but there may still be some result set to process. So even if dbsqlok returns FAIL, dbresults should be called to process any outstanding result set (until NO_MORE_RESULTS is returned).

The dbsqlok function is also useful in text-update operations. When chunks of text are sent to SQL Server using dbmoretext, dbsqlok must be called before the first call to dbmoretext and after the last call to dbmoretext. For an example of its use in this context, see dbwritetext.

Note  This function is one of the four that do not return control to the application until the server sends the required response. The application can be blocked for a considerable time if the server is waiting for a lock or processing a large sort. If this is unacceptable, always call dbdataready before dbsqlok and set the DB-Library time-out to regain control periodically.

See Also

dbcmd

dbsettime

dbfcmd

dbsqlexec

dbmoretext

dbsqlsend

dbnextrow

dbwritetext

dbresults