rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWDBDB2CLILibEnvironmentHandle Class Reference
[DB Access Module for DB2 CLI]

Provides methods for setting and retrieving certain connect time and configuration parameters. More...

#include <rw/db/db2clisrc/db2envh.h>

Inheritance diagram for RWDBDB2CLILibEnvironmentHandle:
RWDBEnvironmentHandle

List of all members.

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)

Detailed Description

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.

Note:
Use of this class reduces an application's portability.

Synopsis

 #include <rw/db/db2clisrc/db2envh.h>
 
 RWDBDB2CLILibEnvironmentHandle* env = 
       (RWDBDB2CLILibEnvironmentHandle*)myDatabase.environmentHandle();

Examples

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();

Member Function Documentation

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.

Note:
Changing the 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.

Note:
IBM deprecated this option as of DB2 8. Please refer to the DB2 CLI documentation from IBM for detailed information.
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.

Note:
DB2 deprecated this functionality in DB2 8. Please refer to the DB2 CLI documentation from IBM for detailed information.
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.

Note:
Using this method binds all character types to the type RWBasicUString instead of RWCString. For more information, see the Internationalization chapter in the DB Access Module for DB2 CLI User's Guide.
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.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.