Set a server or DB-Library option.
RETCODE dbsetopt(dbproc, option, char_param, int_param) DBPROCESS *dbproc; int option; char *char_param; int int_param;
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. If dbproc is NULL, the option will be set for all active DBPROCESS structures.
The option that is to be turned on. See Options for the list of options.
Certain options take parameters. For example, the DBOFFSET option takes as its parameter the construct for which offsets are to be returned:
dbsetopt(dbproc, DBOFFSET, "compute", -1)
The DBBUFFER option takes as its parameter the number of rows to be buffered:
dbsetopt(dbproc, DBBUFFER, "500", -1)
char_param must always be a character string enclosed in quotes, even in the case of a numeric value, as in the DBBUFFER example. If an invalid parameter is specified for one of the server options, this will be discovered the next time a command buffer is sent to the server. The dbsqlexec or dbsqlsend call fails, and DB-Library will invoke the user-installed message handler. If an invalid parameter is specified for one of the DB-Library options (DBBUFFER or DBTEXTLIMIT), the dbsetopt call itself fails.
If the option takes no parameters, char_param must be NULL.
Some options require an additional parameter, int_param, which is the length of the character string passed as char_param. Currently, only DBPRCOLSEP, DBPRLINESEP, and DBPRPAD require this parameter.
If int_param is not required, pass it as -1.
SUCCEED or FAIL.
dbsetopt fails if char_param is invalid for one of the DB-Library options. However, an invalid char_param for a server option will not cause dbsetopt to fail, because such a parameter does not get validated until the command buffer is sent to the server.
This routine sets server and DB-Library options. Although server options may be set and cleared directly through SQL, the application should instead use dbsetopt and dbclropt to set and clear options. This provides a uniform interface for setting both server and DB-Library options. It also allows the application to use the dbisopt function to check the status of an option.
dbsetopt does not immediately set the option. The option is set the next time a command buffer is sent to the server (by invoking dbsqlexec or dbsqlsend).
For a list of each option and its default status, see Options.