SourcePro® API Reference Guide

 
List of all members | Public Member Functions

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

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

Inheritance diagram for RWDBDB2CLILibEnvironmentHandle:
RWDBEnvironmentHandle

Public Member Functions

virtual SQLINTEGER accessMode () const
 
virtual RWDBStatus accessMode (SQLINTEGER mode)
 
virtual SQLINTEGER connectType () const
 
virtual RWDBStatus connectType (SQLINTEGER type)
 
size_t maxBlobSize () const
 
RWDBStatus maxBlobSize (size_t rVal)
 
virtual SQLINTEGER maxConnections () const
 
virtual RWDBStatus maxConnections (SQLINTEGER value)
 
size_t maxStringSize () const
 
RWDBStatus maxStringSize (size_t rVal)
 
virtual SQLINTEGER syncPoint () const
 
virtual RWDBStatus syncPoint (SQLINTEGER value)
 
SQLUINTEGER timeout () const
 
RWDBStatus timeout (SQLUINTEGER val)
 
bool unicodeMode () const
 
void unicodeMode (bool enabled)
 
- Public Member Functions inherited from RWDBEnvironmentHandle
 RWDBEnvironmentHandle ()
 
bool cacheResultSchemas () const
 
bool cacheResultSchemas (bool value)
 
virtual bool foreignKeysFromView ()
 
virtual bool foreignKeysFromView (bool value)
 
size_t maxCachedResultSets () const
 
size_t maxCachedResultSets (size_t value)
 

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*)myDatabase.environmentHandle();
Example
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 portability.
#include <rw/db/db2clisrc/db2envh.h>
// Set connect to false as accessMode must be set
// prior to creating any connections
RWDBDatabase myDatabase = RWDBManager::database(accessLib, serverName, userName, passWord, "");
// 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 SQLINTEGER RWDBDB2CLILibEnvironmentHandle::accessMode ( ) const
virtual

Returns the current setting of the access mode. The default is SQL_MODE_READ_WRITE.

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

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.

size_t RWDBDB2CLILibEnvironmentHandle::maxBlobSize ( ) const

Returns the maximum byte length of blobs retrieved. The default is 128,000.

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.

virtual SQLINTEGER RWDBDB2CLILibEnvironmentHandle::maxConnections ( ) const
virtual
Deprecated:
As of SourcePro 13. This setting is not used by the DB Access Module for DB2 CLI. This function exists only for backward compatibility. Usage of this API should be removed from your application.

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.

virtual RWDBStatus RWDBDB2CLILibEnvironmentHandle::maxConnections ( SQLINTEGER  value)
virtual
Deprecated:
As of SourcePro 13. IBM has deprecated this option as of DB2 8. This setting is not used by the DB Access Module for DB2 CLI. This function exists only for backward compatibility. Usage of this API should be removed from your application.

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.

size_t RWDBDB2CLILibEnvironmentHandle::maxStringSize ( ) const

Returns the maximum byte length of strings retrieved. The default is 128,000.

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.

virtual SQLINTEGER RWDBDB2CLILibEnvironmentHandle::syncPoint ( ) const
virtual

Returns the current setting of syncPoint. The default value is SQL_ONEPHASE.

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

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.

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.

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.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.