Sets a Microsoft® SQL Server™ or DB-Library option.
RETCODE dbsetopt (
PDBPROCESS dbproc,
INT option,
LPCSTR param );
dbsetopt(dbproc, DBOFFSET, "compute")
The DBBUFFER option takes as its parameter the number of rows to be buffered. A parameter with a negative value selects the default (currently 100 rows). A value of 1 is invalid.
dbsetopt(dbproc, DBBUFFER, "500")
Note The param variable must always be a character string enclosed in quotation marks, even in the case of a numeric value, as in the preceding DBBUFFER example.
If the option takes no parameters, param is ignored and may be NULL.
SUCCEED or FAIL.
This function fails if param is invalid for one of the DB-Library options. However, an invalid param for an SQL Server option does not cause dbsetopt to fail, because such a parameter does not get validated until the command buffer is sent to SQL Server.
Although SQL Server options can be set and cleared directly through Transact-SQL, the application should use dbsetopt and dbclropt to set and clear options. This provides a uniform interface for setting both SQL Server and DB-Library options. It also allows the application to use the dbisopt function to check the status of an option.
This function does not immediately set the options specified. They are not set until the command buffer is sent to SQL Server (by invoking the dbsqlexec function). An additional result for each option set is returned through the dbresults function.
dbclropt | dbresults |
dbisopt | dbsqlexec |
DB-Library Options | Bulk-Copy Functions |