The RWDBConnection::systemHandle() method returns a pointer to a base class from which a family of implementation-specific classes is derived. To use the database API directly, an application can downcast this pointer to the appropriate type, and use its implementation-specific features. Naturally, this usage reduces an application's portability.
In the case of a Microsoft SQL Server connection, the implementation-specific system handle has the data type RWDBMsSqlLibSystemHandle. It contains the SQLHDBC used by the RWDBConnection. The following method may be used to retrieve this component:
SQLHDBC hdbc();
If it is necessary for your application to make calls directly to the Microsoft SQL Server ODBC API, proceed as in the following example:
#include <rw/db/msqsrc/msqsysh.h> RWDBConnection conn = myDbase.connection(); RWDBMsSqlLibSystemHandle* handle = (RWDBMsSqlLibSystemHandle*) conn.systemHandle(); SQLHDBC sqlhdbc = handle->hdbc(); // Use sqlhdbc for MS SQL Server ODBC API calls.
NOTE -- When using runtime loading of the DB Access Module for Microsoft SQL Server, the SQLHDBC is not available. For information, see Section 2.19, "Using Static Libraries with MS SQL Server and DB2 CLI Access Modules."
The RWDBMsSqlLibSystemHandle class allows the user to specify a given type of cursor. The cursor types that can be set are:
SQL_CURSOR_KEYSET_DRIVEN SQL_CURSOR_STATIC SQL_CURSOR_FORWARD_ONLY SQL_CURSOR_DYNAMIC
The default value is SQL_CURSOR_KEYSET_DRIVEN.
To determine the cursor type, use function:
SQLUINTEGER cursorType() const;
To set the cursor type, use function:
RWDBStatus cursorType(SQLUINTEGER val);
The RWDBMsSqlLibSystemHandle class allows the user to specify whether or not to perform logging operations on text, ntext, or image columns.
To return the current setting, use function:
bool logTextUpdates() const;
To set logging off or on, use function:
RWDBStatus logTextUpdates(bool val);
The default value is true.
The default size of text, ntext, or image data that can be returned by an SQL Server is set to the maximum of 2GB by the Microsoft SQL Server ODBC driver. To limit the amount of text that a SELECT statement returns, an application must change the default size.
To return the current size setting, use function:
SQLUINTEGER textSize() const;
To specify a new size, use function:
RWDBStatus textSize(SQLUINTEGER size);
© 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.