SourcePro® API Reference Guide

 
List of all members | Public Member Functions

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

#include <rw/db/odbcsrc/odbenvh.h>

Inheritance diagram for RWDBODBCLibEnvironmentHandle:
RWDBEnvironmentHandle

Public Member Functions

int accessMode () const
 
RWDBStatus accessMode (int mode)
 
RWCString currentQualifier () const
 
RWDBStatus currentQualifier (const RWCString &qualifier)
 
int cursorOption () const
 
RWDBStatus cursorOption (int value)
 
int loginTimeout () const
 
RWDBStatus loginTimeout (int value)
 
size_t maxBlobSize () const
 
RWDBStatus maxBlobSize (size_t rVal)
 
size_t maxStringSize () const
 
RWDBStatus maxStringSize (size_t rVal)
 
SQLULEN timeout () const
 
RWDBStatus timeout (SQLULEN val)
 
RWCString traceFileName () const
 
RWDBStatus traceFileName (const RWCString &name)
 
int traceOption () const
 
RWDBStatus traceOption (int val)
 
- 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 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.

Note
Use of this class reduces an application's portability.
Synopsis
#include <rw/db/odbcsrc/odbcenvh.h>
Example
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();
// 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();

Member Function Documentation

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

RWCString RWDBODBCLibEnvironmentHandle::currentQualifier ( ) const

Returns the name of the catalog to be used by the data source.

RWDBStatus RWDBODBCLibEnvironmentHandle::currentQualifier ( const RWCString qualifier)

Sets the catalog name to be used by the data source.

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

size_t RWDBODBCLibEnvironmentHandle::maxBlobSize ( ) const

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

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::maxStringSize ( ) const

Returns the maximum length, in code units, of strings 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.

SQLULEN RWDBODBCLibEnvironmentHandle::timeout ( ) const

Returns the current setting of the timeout value.

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.

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

int RWDBODBCLibEnvironmentHandle::traceOption ( ) const

Returns 1 if the driver manager is set to perform tracing, otherwise returns 0. The default value is 0.

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.

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