dbresults

Description

Set up the results of the next query.

Syntax

RETCODE dbresults(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, FAIL or NO_MORE_RESULTS.

dbresults returns NO_MORE_RESULTS if all commands in the buffer have already been processed. The most common reason for failing is a runtime error, such as a database permission violation.

The number of commands in the command buffer determines whether dbsqlexec or dbresults traps a runtime error. If the buffer contains only a single command, a runtime error will cause dbsqlexec to fail. If the command buffer contains multiple commands, a runtime error will not cause dbsqlexec to fail. Instead, the dbresults call that processes the command causing the runtime error will fail.

The situation is a bit more complicated for runtime errors and stored procedures. A runtime error on an execute command may cause dbresults 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 dbresults 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 dbresults 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

See also

dbbind, dbcancel, dbnextrow, dbpoll, DBRBUF, dbretstatus, DBROWS, dbrpcsend, dbsqlexec, dbsqlok