The functions dbsetopt and dbclropt use the following constants, defined in SQLDB.H, for setting and clearing options. All options are off by default.
There are two ways to convert data with transfers to and from the server:
Or
For Windows NT, use the SQL Client Configuration Utility's Automatic ANSI TO OEM option. This modifies the Registry under the following subtree:
HKEY_LOCAL_MACHINE\
SOFTWARE\
Microsoft\
MSSQLServer\
Client\
DB-Lib
and sets the AutoAnsiToOem entry to ON (AutoAnsiToOem:REG_SZ:ON). This is the default entry.
The AutoANSItoOEM entry controls the default conversion behavior when you connect to a server. If AutoANSItoOEM is set to ON, conversion is turned on in the following cases:
If AutoANSItoOEM is set to OFF, conversion is turned off for all connections.
You can override the default conversion by calling dbsetopt after calling dbopen.
Use the DBANSItoOEM option to enable conversion when connecting an ANSI client to an OEM server. Use the DBOEMtoANSI option to enable conversion when connecting to an OEM client (Windows NT Console application) to an ISO server. You cannot set both options for the same DBPROCESS.
Row buffering keeps a specified number of SQL Server result rows in the program's memory. Without row buffering, the result row generated by each new dbnextrow call overwrites the contents of the previous result row. So use row buffering for programs that need to look at result rows nonsequentially.
When turned on, DBBUFFER reduces memory and performance because each row in the buffer must be allocated and freed individually. Therefore, write the application to turn on the DBBUFFER option only if it calls dbgetrow. Note that row buffering, an independent issue, has nothing to do with network buffering. (For more information about row buffering, see dbgetrow, dbnextrow, and dbclrbuf in DB-Library Functions.)
DBCLIENTCURSORS
Forces the use of client cursors. When this option is set, every cursor opened with dbcursoropen will be a client cursor. Even when connected to SQL Server 6.0, server cursors will not be used.
This option can be enabled for a client running Windows by placing the line UseClientCursors=ON in the [SQLSERVER] section of WIN.INI. This option can be enabled for a client running Windows NT by setting the value UseClientCursors to ON (UseClientCursors : REG_SZ : ON) in the following Windows NT Registry key:
HKEY_LOCAL_MACHINE\
SOFTWARE\
Microsoft\
MSSQLServer\
Client\
DB-Lib
Note The value param refers to parameters of stored procedures.
Calls to functions such as dbsetopt can specify these parameters in either uppercase or lowercase. For the internal types that correspond to the offsets, see dbgetoff in DB-Library Functions. Offsets are returned only if the batch contains no syntax errors.
In the case of huge text values, it may take some time for the entire text value to be returned over the network. To keep SQL Server from sending this extra text, use the DBTEXTSIZE option instead of DBTEXTLIMIT.
Note that, in programs that allow ad hoc queries, the application user can override this option with the Transact-SQL SET TEXTSIZE command. To set a text limit that the user cannot override, use the DBTEXTLIMIT option instead.
DBBUFFER, DBNOAUTOFREE, and DBTEXTLIMIT are DB-Library options. That is, they affect DB-Library but are not sent to SQL Server. The others are SQL Server options (options that get sent to the SQL Server). You can set them with Transact-SQL.
As mentioned in the preceding descriptions, certain options take parameters. The following table lists these options and the possible values of their parameters:
Option | Possible parameter values |
---|---|
DBBUFFER | 0 to 32767 |
DBOFFSET | select, from, table, order, compute, statement, procedure, execute, or param |
DBROWCOUNT | 0 to 2,147,483,647 |
DBSTAT | io or time |
DBTEXTLIMIT | 0 to 65,534 |
DBTEXTSIZE | 0 to 2,147,483,647 |
The function dbsetopt requires you to specify parameters when setting any of the options in the preceding table. On the other hand, the functions dbclropt and dbisopt require you to specify a parameter only for DBOFFSET and DBSTAT, because they can have simultaneous multiple settings, which require further definition before being cleared or checked.
Note that parameters specified in calls to dbsetopt, dbclropt, and dbisopt are always passed as character strings and enclosed in quotation marks, even if they are numeric values. For more information, see dbsetopt, dbclropt, and dbisopt in DB-Library Functions.