SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Provides methods for setting and retrieving certain connect time and configuration parameters with ODBC. More...
#include <rw/db/odbcsrc/odbenvh.h>
Public Member Functions | |
int | loginTimeout () const |
RWDBStatus | loginTimeout (int value) |
SQLULEN | timeout () const |
RWDBStatus | timeout (SQLULEN val) |
int | cursorOption () const |
RWDBStatus | cursorOption (int value) |
int | traceOption () const |
RWDBStatus | traceOption (int val) |
RWCString | traceFileName () const |
RWDBStatus | traceFileName (const RWCString &name) |
int | accessMode () const |
RWDBStatus | accessMode (int mode) |
RWCString | currentQualifier () const |
RWDBStatus | currentQualifier (const RWCString &qualifier) |
size_t | maxBlobSize () const |
RWDBStatus | maxBlobSize (size_t rVal) |
size_t | maxStringSize () const |
RWDBStatus | maxStringSize (size_t rVal) |
Class RWDBODBCLibEnvironmentHandle provides methods for setting and retrieving certain connect time and configuration parameters.
Please note that some connect time parameters are set only when a connection is established with the server. When the method returns a valid RWDBStatus for these parameters, it does not necessarily mean that the connection parameter has been accepted by the server. Appropriate error messages will be fielded to the application only when a connection is established.
#include <rw/db/odbcsrc/odbcenvh.h> RWDBODBCLibEnvironmentHandle* env = (RWDBODBCLibEnvironmentHandle*)myDatabase.environmentHandle();
The following example shows how to gain access to RWDBODBCLibEnvironmentHandle. Note that the application must be compiled with an include path to the ODBC include files.
#include <rw/db/odbcsrc/odbenvh.h> RWDBEnvironmentHandle* enH = adb.environmentHandle(); RWDBODBCLibEnvironmentHandle* odbcH = (RWDBODBCLibEnvironmentHandle*)enH; // Set access mode odbcH->accessMode(SQL_MODE_READ_ONLY); // Get a connection created with a read-only access mode. // Any attempt to change the database through this connection // will result in a driver error. RWDBConnection conn = adb.connection();
RWDBStatus RWDBODBCLibEnvironmentHandle::accessMode | ( | int | mode | ) |
Sets the connection mode for all new connections. The value of mode can be one of SQL_MODE_READ_ONLY
for read-only connections or SQL_MODE_READ_WRITE
for connections that allow updates.
int RWDBODBCLibEnvironmentHandle::accessMode | ( | ) | const |
Returns SQL_MODE_READ_ONLY
if new connections are to be read-only, or SQL_MODE_READ_WRITE
for connections that allow updates. The default is SQL_MODE_READ_WRITE
.
RWDBStatus RWDBODBCLibEnvironmentHandle::currentQualifier | ( | const RWCString & | qualifier | ) |
Sets the catalog name to be used by the data source.
RWCString RWDBODBCLibEnvironmentHandle::currentQualifier | ( | ) | const |
Returns the name of the catalog to be used by the data source.
RWDBStatus RWDBODBCLibEnvironmentHandle::cursorOption | ( | int | value | ) |
Sets a flag indicating how the driver manager uses the ODBC cursor library.
The value of value can be one of SQL_CUR_USE_IF_NEEDED
, SQL_CUR_USE_ODBC
or SQL_CUR_USE_DRIVER
.
int RWDBODBCLibEnvironmentHandle::cursorOption | ( | ) | const |
Returns a value indicating how the driver manager uses the ODBC cursor library. The default value is SQL_CUR_USE_DRIVER
.
RWDBStatus RWDBODBCLibEnvironmentHandle::loginTimeout | ( | int | value | ) |
Sets the maximum number of seconds for the driver to wait for a login response when making a connection attempt. Setting a value of zero causes the connection attempt to wait indefinitely.
int RWDBODBCLibEnvironmentHandle::loginTimeout | ( | ) | const |
Returns the current value for the maximum number of seconds the driver waits for a login response when making a connection attempt. The default value is driver dependent. If set to zero, the connection attempt waits indefinitely.
RWDBStatus RWDBODBCLibEnvironmentHandle::maxBlobSize | ( | size_t | rVal | ) |
Sets the maximum byte length of blobs retrieved, to rVal. If the size of the blob data column being fetched is greater than the value last set, then an attempt is made to fetch the data in parts. If this is not possible, then the data is truncated to rVal bytes.
size_t RWDBODBCLibEnvironmentHandle::maxBlobSize | ( | ) | const |
Returns the maximum byte length of blobs retrieved. The default is 128,000.
RWDBStatus RWDBODBCLibEnvironmentHandle::maxStringSize | ( | size_t | rVal | ) |
Sets the maximum length, in code units, of strings retrieved, to rVal. If the size of the string data column being fetched is greater than the value last set, then an attempt is made to fetch the data in parts. If this is not possible, then the data is truncated to rVal code units.
size_t RWDBODBCLibEnvironmentHandle::maxStringSize | ( | ) | const |
Returns the maximum length, in code units, of strings retrieved. The default is 128,000.
RWDBStatus RWDBODBCLibEnvironmentHandle::timeout | ( | SQLULEN | val | ) |
Sets the maximum number of seconds to wait for an SQL statement to execute before returning to the application. The application can set this value any time. It takes effect for all open connections immediately upon being called.
SQLULEN RWDBODBCLibEnvironmentHandle::timeout | ( | ) | const |
Returns the current setting of the timeout value.
RWDBStatus RWDBODBCLibEnvironmentHandle::traceFileName | ( | const RWCString & | name | ) |
Sets the trace file to name. If tracing is not enabled, this file name is ignored. If tracing is enabled, the driver writes to this file each time a ODBC function call is made.
RWCString RWDBODBCLibEnvironmentHandle::traceFileName | ( | ) | const |
Returns the name of the file used for tracing. If no trace file has been specified, the driver manager writes to SQL.LOG
.
RWDBStatus RWDBODBCLibEnvironmentHandle::traceOption | ( | int | val | ) |
Sets the trace mode. A value of 0
disables tracing, and a value of 1
enables it. When tracing is on, the driver manager writes each ODBC function call to the trace file. See the method traceFileName() for specifying a trace file name. Please refer to your ODBC driver's documentation for more information.
int RWDBODBCLibEnvironmentHandle::traceOption | ( | ) | const |
Returns 1
if the driver manager is set to perform tracing, otherwise returns 0
. The default value is 0
.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.