SourcePro® 2023.1 |
SourcePro® API Reference Guide |
A monostate class that manages RWDBDatabase instances, thus mediating access to database servers. More...
#include <rw/db/dbmgr.h>
Static Public Member Functions | |
static RWDBDatabase | database (const RWCString &serverType, const RWCString &serverName, const RWCString &userName, const RWCString &password, const RWCString &databaseName, const RWDBDatabaseCallback &databasecb=RWDBDatabaseCallback()) |
static RWDBDatabase | database (const RWCString &serverType, const RWCString &serverName, const RWCString &userName, const RWCString &password, const RWCString &databaseName, const RWCString &propertyString, const RWDBDatabaseCallback &databasecb=RWDBDatabaseCallback()) |
static bool | emptyStringIsNull () |
static void | emptyStringIsNull (bool n) |
static RWDBStatus::ErrorHandler | errorHandler () |
static RWDBStatus::ErrorHandler | setErrorHandler (RWDBStatus::ErrorHandler handler) |
static RWCString | version () |
static void * | xaSwitch (const RWCString &serverType) |
There is a single, global RWDBManager in charge of producing RWDBDatabase instances typed according to the application's request. It mediates access to database servers, abstracting details of access to vendor-supplied libraries, including any dynamic loading and linking. The RWDBManager, through its database() method, is responsible for filling requests for database implementations of a particular type. To do so, it maintains a set of database types for which it is able to produce an implementation.
Associated with each database type is a method that produces the implementation. Once this method is invoked, a connection is established and the result is returned to the caller. In a static build, this method resides in the statically linked Access Module library. In a dynamic build, this method resides in the dynamically-linked Access Module library that is loaded at runtime.
For the DB XA Module you provide a sixth parameter, propertyString
, defined with key XA=xaParameter
. This produces an XA-enabled RWDBDatabase object. For database-specific values of xaParameter
, see the DB XA Module User's Guide.
|
static |
Produces an RWDBDatabase. The first parameter lets the DB Interface Module identify the kind of database being requested. The remaining parameters except the last are used to establish a session with the requested database server. Since the details of logging into a database vary widely among vendors, the actual values supplied for the various parameters vary according to the DB Access Module which will be used. Your DB Access Module guide explains the values you must supply to obtain RWDBDatabase instances from your library. The last parameter provides an instance of the RWDBDatabaseCallback to be associated with the produced RWDBDatabase object.
|
static |
Produces an RWDBDatabase. The first parameter lets the DB Interface Module identify the kind of database being requested. The remaining parameters except the last are used to establish a session with the requested database server. Since the details of logging into a database vary widely among vendors, the actual values supplied for the various parameters vary according to the DB Access Module which will be used. Your DB Access Module guide explains the values you must supply to obtain RWDBDatabase instances from your library. The last parameter provides an instance of the RWDBDatabaseCallback to be associated with the produced RWDBDatabase object.
DB XA Module: The sixth parameter, propertyString, is used to set the key XA=xaParameter
.
|
static |
Retrieves the setting of this flag.
|
static |
Allows an application to specify whether the RWDBDatabase instance produced by the call to RWDBManager::database() treats empty strings as NULL
values.
The default setting is false
, which means that empty strings are handled as the database vendor normally handles them. If this flag is set to true
, empty strings are treated as NULL
values by SourcePro DB.
Note that the SQL92 standard does not specify if empty strings are NULL
values or not. Various database vendors treat empty strings differently. For example, Oracle considers an empty string to be the same as a NULL
, while other database vendors do not. Consider the following example:
If the setting is true
, the SQL generated is like:
Otherwise, it is like:
However, these two SQL statements mean the same to Oracle. Setting the flag to true
has no effect.
|
static |
Retrieves the error handler currently installed in the RWDBManager, if any.
|
static |
Installs handler as the error handler for the RWDBManager. The supplied handler is inherited by all RWDBDatabase instances created by the RWDBManager. By default, the RWDBManager error handler does nothing; this method overrides the default.
|
static |
Returns a string that identifies the version of the DB Interface Module in which self resides.
|
static |
DB XA Module Only
Returns a database-specific XA switch table based on the server type. The switch table is a structure that lists the names of the xa_
routines implemented in the resource manager. Note that this function returns a void*
, which must be cast to a struct xa_switch_t
pointer.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |