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. More...
#include <rw/db/db2clisrc/db2envh.h>
Public Member Functions | |
virtual SQLINTEGER | maxConnections () const |
virtual RWDBStatus | maxConnections (SQLINTEGER value) |
virtual SQLINTEGER | connectType () const |
virtual RWDBStatus | connectType (SQLINTEGER type) |
virtual SQLINTEGER | syncPoint () const |
virtual RWDBStatus | syncPoint (SQLINTEGER value) |
virtual SQLINTEGER | accessMode () const |
virtual RWDBStatus | accessMode (SQLINTEGER mode) |
size_t | maxBlobSize () const |
RWDBStatus | maxBlobSize (size_t rVal) |
size_t | maxStringSize () const |
RWDBStatus | maxStringSize (size_t rVal) |
bool | unicodeMode () const |
void | unicodeMode (bool enabled) |
SQLUINTEGER | timeout () const |
RWDBStatus | timeout (SQLUINTEGER val) |
Class RWDBDB2CLILibEnvironmentHandle 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 are fielded to the application only when a connection is established.
#include <rw/db/db2clisrc/db2envh.h> RWDBDB2CLILibEnvironmentHandle* env = (RWDBDB2CLILibEnvironmentHandle*)myDatabase.environmentHandle();
The following example shows how to gain access to RWDBDB2CLILibEnvironmentHandle. Note that the application must be compiled with an include path to the DB2 CLI include files, thus reducing the application's portablility.
#include <rw/db/db2clisrc/db2envh.h> // Set connect to false as accessMode must be set // prior to creating any connections RWDBDatabase::connect(false); RWDBDatabase myDatabase = RWDBManager::database(accessLib, serverName, userName, passWord, ""); RWDBDB2CLILibEnvironmentHandle* env = (RWDBDB2CLILibEnvironmentHandle*)myDatabase.environmentHandle(); // set the access mode env->accessMode(SQL_MODE_READ_ONLY); // Get the first connection to the server RWDBConnection conn = myDatabase.connection();
virtual RWDBStatus RWDBDB2CLILibEnvironmentHandle::accessMode | ( | SQLINTEGER | mode | ) | [virtual] |
Sets the connection mode for all new connections. The value of mode can be either SQL_MODE_READ_ONLY
or SQL_MODE_READ_WRITE
. Please refer to the DB2 CLI documentation from IBM for detailed information.
SQL_ATTR_ACCESS_MODE
attribute affects only connections opened after that point. Connections that are already open are not affected. virtual SQLINTEGER RWDBDB2CLILibEnvironmentHandle::accessMode | ( | ) | const [virtual] |
Returns the current setting of the access mode. The default is SQL_MODE_READ_WRITE
.
virtual RWDBStatus RWDBDB2CLILibEnvironmentHandle::connectType | ( | SQLINTEGER | type | ) | [virtual] |
Sets the connection type. Possible values are SQL_CONCURRENT_TRANS
, which means that applications operate in an uncoordinated distributed environment, or SQL_COORDINATED_TRANS
which means processing is coordinated. The connect type can only be set when no connections are open. Please refer to your DB2CLI documentation for detailed information about this setting.
virtual SQLINTEGER RWDBDB2CLILibEnvironmentHandle::connectType | ( | ) | const [virtual] |
Returns the connection type. Possible values are SQL_CONCURRENT_TRANS
and SQL_COORDINATED_TRANS
. (See connectType(SQLINTEGER type) for the meaning of these connection types.)
The default value is SQL_CONCURRENT_TRANS
.
RWDBStatus RWDBDB2CLILibEnvironmentHandle::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 RWDBDB2CLILibEnvironmentHandle::maxBlobSize | ( | ) | const |
Returns the maximum byte length of blobs retrieved. The default is 128,000.
virtual RWDBStatus RWDBDB2CLILibEnvironmentHandle::maxConnections | ( | SQLINTEGER | value | ) | [virtual] |
Set the maximum number of concurrent connections. This attribute can be set only when no connections are opened. Returns a RWDBStatus indicating whether the operation was successful.
The default value of 0 allows the application to set up as many connections as system resources permit. Any other value indicates a limit on the number of connections.
virtual SQLINTEGER RWDBDB2CLILibEnvironmentHandle::maxConnections | ( | ) | const [virtual] |
Returns the maximum number of concurrent connections. The default value is 0, meaning that the application is allowed to set up as many connections as system resources permit.
RWDBStatus RWDBDB2CLILibEnvironmentHandle::maxStringSize | ( | size_t | rVal | ) |
Sets the maximum byte length 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 bytes.
size_t RWDBDB2CLILibEnvironmentHandle::maxStringSize | ( | ) | const |
Returns the maximum byte length of strings retrieved. The default is 128,000.
virtual RWDBStatus RWDBDB2CLILibEnvironmentHandle::syncPoint | ( | SQLINTEGER | value | ) | [virtual] |
Sets how transactions are coordinated. Possible values for value are SQL_ONEPHASE
and SQL_TWOPHASE
. The sync point can be set only when no connections are open.
virtual SQLINTEGER RWDBDB2CLILibEnvironmentHandle::syncPoint | ( | ) | const [virtual] |
Returns the current setting of syncPoint
. The default value is SQL_ONEPHASE
.
RWDBStatus RWDBDB2CLILibEnvironmentHandle::timeout | ( | SQLUINTEGER | val | ) |
Defines the length of time in 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.
SQLUINTEGER RWDBDB2CLILibEnvironmentHandle::timeout | ( | ) | const |
Returns the current value for the maximum number of seconds to wait for an SQL statement to execute before returning to the application.
void RWDBDB2CLILibEnvironmentHandle::unicodeMode | ( | bool | enabled | ) |
Sets how the access module maps string data.
A setting of true
changes the default mapping when retrieving data, to RWBasicUString instead of RWCString.
bool RWDBDB2CLILibEnvironmentHandle::unicodeMode | ( | ) | const |
Returns whether the access module maps string data to type RWCString (the default) or to type RWBasicUString in support of the Unicode UTF-16 data standard. The default value is false
.
© 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.