SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDBDatabase Class Reference

Manages connections with database servers. More...

#include <rw/db/dbase.h>

Public Types

enum  { UserTable , SystemTable , View , Synonym }
 
enum  AdjustCaseType { Exact , Normalize }
 

Public Member Functions

 RWDBDatabase ()
 
 RWDBDatabase (const RWDBDatabase &dbase)
 
void acquire (void) const
 
RWDBCacheManagercacheManager () const
 
RWDBCacheManagercacheManager (RWDBCacheManager *mgr)
 
RWCString::caseCompare caseCompare () const
 
RWCString::caseCompare caseCompare (RWCString::caseCompare cmp)
 
RWDBConnection connection (const RWDBConnCallback &conncb, RWDBConnection::ConnectionType type=RWDBConnection::Synchronous) const
 
RWDBConnection connection (RWDBConnection::ConnectionType type=RWDBConnection::Synchronous) const
 
RWDBStatus createProcedure (const RWCString &name, const RWCString &sql) const
 
RWDBStatus createProcedure (const RWCString &name, const RWCString &sql, const RWDBConnection &connection) const
 
RWDBStatus createProcedure (const RWCString &name, const RWCString &sql, const RWDBSchema &params) const
 
RWDBStatus createProcedure (const RWCString &name, const RWCString &sql, const RWDBSchema &params, const RWDBConnection &connection) const
 
RWDBStatus createProcedure (const RWDBStoredProc &proc) const
 
RWDBStatus createProcedure (const RWDBStoredProc &proc, const RWDBConnection &connection) const
 
RWDBStatus createTable (const RWCString &name, const RWDBSchema &schema) const
 
RWDBStatus createTable (const RWCString &name, const RWDBSchema &schema, const RWDBConnection &connection) const
 
RWDBStatus createTable (const RWDBTable &table) const
 
RWDBStatus createTable (const RWDBTable &table, const RWDBConnection &connection) const
 
RWDBStatus createView (const RWCString &viewName, const RWCString &sql) const
 
RWDBStatus createView (const RWCString &viewName, const RWCString &sql, const RWDBConnection &connection) const
 
RWDBStatus createView (const RWCString &viewName, const RWDBSchema &columnList, const RWCString &sql) const
 
RWDBStatus createView (const RWCString &viewName, const RWDBSchema &columnList, const RWCString &sql, const RWDBConnection &connection) const
 
RWDBStatus createView (const RWCString &viewName, const RWDBSchema &columnList, const RWDBSelectorBase &select) const
 
RWDBStatus createView (const RWCString &viewName, const RWDBSchema &columnList, const RWDBSelectorBase &select, const RWDBConnection &connection) const
 
RWDBStatus createView (const RWCString &viewName, const RWDBSelectorBase &select) const
 
RWDBStatus createView (const RWCString &viewName, const RWDBSelectorBase &select, const RWDBConnection &connection) const
 
RWDBCursor cursor (const RWCString &select, const RWDBSchema &updateCols, const RWDBConnection &connection, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWCString &select, const RWDBSchema &updateCols, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWCString &sql, const RWDBConnection &connection, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWCString &sql, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBCompoundSelector &select, const RWDBConnection &connection, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBCompoundSelector &select, const RWDBSchema &updateCols, const RWDBConnection &connection, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBCompoundSelector &select, const RWDBSchema &updateCols, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBCompoundSelector &select, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBSelector &select, const RWDBConnection &connection, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBSelector &select, const RWDBSchema &updateCols, const RWDBConnection &connection, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBSelector &select, const RWDBSchema &updateCols, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBSelector &select, RWDBCursor::CursorType cursorType=RWDBCursor::Sequential, RWDBCursor::CursorAccess cursorAccess=RWDBCursor::Read) const
 
RWDBDateVector dateVector (size_t n) const
 
RWCString dbName () const
 
RWDBTable dbStoredProcedures () const
 
RWDBTable dbStoredProcedures (const RWCString &name, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbStoredProcedures (const RWCString &name, const RWCString &owner, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbStoredProcedures (const RWDBConnection &conn) const
 
RWDBTable dbStoredProcedures (const RWDBConnection &conn, const RWCString &name, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbStoredProcedures (const RWDBConnection &conn, const RWCString &name, const RWCString &owner, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbTables (const RWCString &name, const RWCString &owner, int type=SystemTable|UserTable|View|Synonym, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbTables (const RWCString &name, int type=SystemTable|UserTable|View|Synonym, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbTables (const RWDBConnection &conn, const RWCString &name, const RWCString &owner, int type=SystemTable|UserTable|View|Synonym, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbTables (const RWDBConnection &conn, const RWCString &name, int type=SystemTable|UserTable|View|Synonym, AdjustCaseType adjustCase=Normalize) const
 
RWDBTable dbTables (const RWDBConnection &conn, int type=SystemTable|UserTable|View|Synonym) const
 
RWDBTable dbTables (int type=SystemTable|UserTable|View|Synonym) const
 
size_t defaultConnections () const
 
size_t defaultConnections (size_t size)
 
RWDBDeleter deleter (const RWDBTable &table) const
 
RWDBDeleter deleter (const RWDBTable &table, const RWDBCriterion &criterion) const
 
RWDBStatus dropView (const RWCString &viewName)
 
RWDBStatus dropView (const RWCString &viewName, const RWDBConnection &connection)
 
bool emptyStringIsNull () const
 
RWDBEnvironmentHandleenvironmentHandle () const
 
RWDBStatus::ErrorHandler errorHandler () const
 
RWDBInserter inserter (const RWDBTable &table, const RWDBCompoundSelector &selector) const
 
RWDBInserter inserter (const RWDBTable &table, const RWDBCompoundSelector &selector, const RWDBSchema &columnList) const
 
RWDBInserter inserter (const RWDBTable &table, const RWDBSchema &columnList, size_t cache=1) const
 
RWDBInserter inserter (const RWDBTable &table, const RWDBSelector &selector) const
 
RWDBInserter inserter (const RWDBTable &table, const RWDBSelector &selector, const RWDBSchema &columnList) const
 
RWDBInserter inserter (const RWDBTable &table, size_t cache=1) const
 
bool isReady () const
 
bool isValid () const
 
RWDBMemTable memTable (const RWCString &name, const RWDBConnection &connection, size_t capacity=0) const
 
RWDBMemTable memTable (const RWCString &name, size_t capacity=0) const
 
bool operator!= (const RWDBDatabase &dbase) const
 
RWDBDatabaseoperator= (const RWDBDatabase &dbase)
 
bool operator== (const RWDBDatabase &dbase) const
 
RWCString passWord () const
 
RWCString passWord (const RWCString &pwd)
 
const RWDBPhraseBookphraseBook () const
 
void release (void) const
 
RWDBSelector selector () const
 
RWDBSelector selector (const RWDBCriterion &criterion) const
 
RWCString serverName () const
 
RWCString serverType () const
 
void setErrorHandler (RWDBStatus::ErrorHandler handler)
 
RWDBStatus status () const
 
RWDBStoredProc storedProc (const RWCString &name) const
 
RWDBStoredProc storedProc (const RWCString &name, const RWDBConnection &connection) const
 
RWDBStoredProc storedProc (const RWCString &name, const RWDBConnection &connection, const RWDBSchema &sch, const RWDBColumn &col=RWDBColumn(), const RWCString &text=RWCString()) const
 
RWDBStoredProc storedProc (const RWCString &name, const RWDBSchema &sch, const RWDBColumn &col=RWDBColumn(), const RWCString &text=RWCString()) const
 
RWDBTable table (const RWCString &name) const
 
RWDBTable table (const RWCString &name, const RWDBSchema &schema, bool isView=false) const
 
RWDBTable table (const RWDBSelectorBase &selector) const
 
const RWZonetimeZone () const
 
const RWZonetimeZone (const RWZone *zone)
 
size_t totalConnections () const
 
RWDBTracertracer ()
 
RWDBUpdater updater (const RWDBTable &table) const
 
RWDBUpdater updater (const RWDBTable &table, const RWDBCriterion &criterion) const
 
RWCString userName () const
 
bool verboseAsString () const
 
bool verboseAsString (bool verbose)
 
RWCString version () const
 

Static Public Member Functions

static bool connect ()
 
static void connect (bool enable)
 

Related Symbols

(Note that these are not member symbols.)

#define rwdbAllTypes
 

Detailed Description

RWDBDatabase manages connections with database servers. A database object represents a server, a user on that server, and a database opened for that user. Database objects are produced by the RWDBManager. Class RWDBDatabase provides an interface for obtaining database-specific objects and data definition language (DDL) concepts.

RWDBDatabase is designed around the Interface/Implementation paradigm. An RWDBDatabase instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation. An RWDBDatabase implementation is a base class from which a family of database-specific implementations is derived.

Every valid RWDBDatabase implementation has a database type. For example, the database type might be Sybase or Oracle. Applications request RWDBDatabase objects of a particular type by specifying the type to the RWDBManager; once a valid RWDBDatabase instance is obtained, its implementation type is transparent to the application. Objects produced by an RWDBDatabase instance automatically have the same implementation type as the producer. For example, a Sybase type RWDBDatabase automatically produces Sybase type RWDBTable objects.

Synopsis
#include <rw/db/dbase.h>
#include <rw/db/dbmgr.h>
"accessLib", "Servername", "Username", "Password", "DatabaseName");
Manages connections with database servers.
Definition dbase.h:91
static RWDBDatabase database(const RWCString &serverType, const RWCString &serverName, const RWCString &userName, const RWCString &password, const RWCString &databaseName, const RWDBDatabaseCallback &databasecb=RWDBDatabaseCallback())

DB XA Module

In the DB Interface Module, database objects are produced by calling RWDBManager::database() and defining the propertyString parameter with key XA=xaParameter. Class RWDBDatabase provides an interface for obtaining XA-enabled database-specific objects. For database-specific values of xaParameter, see the DB XA Module User's Guide.

Note
In an XA environment, use of DDL calls may result in a server error. DDL calls can be used before XA connectivity is established.

In the XA environment, you would create an RWDBDatabase instance like this:

RWDBDatabase dBase =
RWDBManager::database("accessLib", "", "", "", "", "XA=xaParameter");

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

These enumeration values are used in dbTables() to make up the type argument.

Enumerator
UserTable 

User table

SystemTable 

System table

View 

Views

Synonym 

Synonyms

◆ AdjustCaseType

These enumeration values are used in dbTables() and dbStoredProcedures() calls to indicate whether or not the case of the search parameters should be normalized for the database.

Enumerator
Exact 

Exact value; search parameters are not normalized.

Normalize 

Normalized value; search parameters are converted to the default case of the database.

Constructor & Destructor Documentation

◆ RWDBDatabase() [1/2]

RWDBDatabase::RWDBDatabase ( )

Default constructor that creates a database with a status of RWDBStatus::notInitialized. This constructor is provided for convenience; usable RWDBDatabase objects must be obtained from the RWDBManager.

◆ RWDBDatabase() [2/2]

RWDBDatabase::RWDBDatabase ( const RWDBDatabase & dbase)

Copy constructor. The object created shares an implementation with dbase.

Member Function Documentation

◆ acquire()

void RWDBDatabase::acquire ( void ) const

Attempts to acquire the internal mutex lock. If the mutex is already locked by another thread, the function blocks until the mutex is released. This function can be called from a const object.

Note
In single-threaded builds, this function evaluates to a no-op.

◆ cacheManager() [1/2]

RWDBCacheManager * RWDBDatabase::cacheManager ( ) const

Returns a pointer to the currently installed cache manager. If a cache manager is not installed, returns NULL.

◆ cacheManager() [2/2]

RWDBCacheManager * RWDBDatabase::cacheManager ( RWDBCacheManager * mgr)

Sets the cache manager to mgr. Returns a pointer to the previous cache manager. Pass NULL to unset the cache manager.

Note
It is the application's responsibility to ensure that mgr has a lifetime greater than self or any object produced from self.

◆ caseCompare() [1/2]

RWCString::caseCompare RWDBDatabase::caseCompare ( ) const

Returns the current value of self's case comparison setting. If it is set to RWCString::exact, objects produced by self use case sensitive search when looking for objects by name; if it is set to RWCString::ignoreCase, objects use case-insensitive search. The default for any particular implementation is set to mirror the behavior of the underlying database. RWDBTable uses the case comparison setting when accessing columns by name.

◆ caseCompare() [2/2]

RWCString::caseCompare RWDBDatabase::caseCompare ( RWCString::caseCompare cmp)

Sets self's case comparison setting to cmp, and returns its previous value.

◆ connect() [1/2]

static bool RWDBDatabase::connect ( )
static

Accessor function that returns the connection policy set by the mutator.

◆ connect() [2/2]

static void RWDBDatabase::connect ( bool enable)
static

Allows an application to specify whether the call to RWDBManager::database() should result in a database that establishes a physical connection to the server. By default, the DB Interface Module establishes a default connection to the server when an RWDBDatabase object is produced. To change this behavior, an application calls RWDBDatabase::connect() with enable set to false. In this case, a connection to the server is established only when a statement is to be executed against the server, or when a connection is explicitly created by the application.

A side effect of disabling the initial connection is that the RWDBDatabase is always valid. If the subsequent first connection attempt fails, the status of the RWDBDatabase object will remain unchanged and the RWDBConnection should be inspected to determine the connection status.

This method is a static method and affects the creation of all databases within an application. For related topics, see RWDBEnvironmentHandle.

DB XA Module: The default behavior is to obtain the XA connection from the server. Alternatively, the connection is obtained only when a statement is to be executed, or when a connection is explicitly created by the application.

◆ connection() [1/2]

RWDBConnection RWDBDatabase::connection ( const RWDBConnCallback & conncb,
RWDBConnection::ConnectionType type = RWDBConnection::Synchronous ) const

Produces an RWDBConnection that provides a connection to self. On return, the connection is either open and ready for use, or RWDBConnection::isValid() of the produced RWDBConnection object returns false. The argument conncb provides an instance of the RWDBConnCallback to be associated with the produced RWDBConnection object. The connection produced is not fetched from the connection pool nor is it returned to the connection pool.

DB XA Module: With the exception of Sybase, this method produces a RWDBStatus::notSupported error if used to create more than one connection.

◆ connection() [2/2]

Produces an RWDBConnection that provides a connection to self. On return, the connection is either open and ready for use, or RWDBConnection::isValid() of the produced RWDBConnection object returns false.

DB XA Module: With the exception of Sybase, this method produces a RWDBStatus::notSupported error if used to create more than one connection.

◆ createProcedure() [1/6]

RWDBStatus RWDBDatabase::createProcedure ( const RWCString & name,
const RWCString & sql ) const

Uses a default connection to create a stored procedure with the given name in the database. The supplied sql is used as the body of the new procedure. The new procedure takes no parameters. You can check the return value's isValid() method to determine whether the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createProcedure() [2/6]

RWDBStatus RWDBDatabase::createProcedure ( const RWCString & name,
const RWCString & sql,
const RWDBConnection & connection ) const

Uses the supplied connection to create a stored procedure with the given name in the database. The supplied sql is used as the body of the new procedure. The new procedure takes no parameters. You can check the return value's isValid() method to determine whether the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createProcedure() [3/6]

RWDBStatus RWDBDatabase::createProcedure ( const RWCString & name,
const RWCString & sql,
const RWDBSchema & params ) const

Uses a default connection to create a stored procedure with the given name in the database. The supplied sql is used as the body of the new procedure. The new procedure's parameters are specified by params. You can check the return value's isValid() method to determine whether the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createProcedure() [4/6]

RWDBStatus RWDBDatabase::createProcedure ( const RWCString & name,
const RWCString & sql,
const RWDBSchema & params,
const RWDBConnection & connection ) const

Uses the supplied connection to create a stored procedure with the given name in the database. The supplied sql is used as the body of the new procedure. The new procedure's parameters are specified by params. You can check the return value's isValid() method to determine whether the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createProcedure() [5/6]

RWDBStatus RWDBDatabase::createProcedure ( const RWDBStoredProc & proc) const

Uses a default connection to create a stored procedure in the database. Also opens a connection to the database of proc. The new procedure's name, parameter definitions, and body are copied from the supplied proc. You can check the return value's isValid() method to determine whether the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createProcedure() [6/6]

RWDBStatus RWDBDatabase::createProcedure ( const RWDBStoredProc & proc,
const RWDBConnection & connection ) const

Uses the supplied connection to create a stored procedure in the database. Also opens a connection to the database of proc. The new procedure's name, parameter definitions and SQL body are copied from the supplied proc. You can check the return value's isValid() method to determine whether the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createTable() [1/4]

RWDBStatus RWDBDatabase::createTable ( const RWCString & name,
const RWDBSchema & schema ) const

Uses a default connection to create a new table in the database. Creates the table with the given name and schema. The new table has no data in it. You can check the return value's isValid() method to determine whether the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createTable() [2/4]

RWDBStatus RWDBDatabase::createTable ( const RWCString & name,
const RWDBSchema & schema,
const RWDBConnection & connection ) const

Uses the supplied connection to create a new table in the database. Creates the table with the given name and schema. The new table has no data in it. You can check the return value's isValid() method to determine whether the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createTable() [3/4]

RWDBStatus RWDBDatabase::createTable ( const RWDBTable & table) const

Uses a default connection to create a new table in the database. Creates the table with the same name and schema as the given table. The new table has no data in it. You can check the return value's isValid() method to determine whether the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createTable() [4/4]

RWDBStatus RWDBDatabase::createTable ( const RWDBTable & table,
const RWDBConnection & connection ) const

Uses the supplied connection to create a new table in the database. Creates the table with the same name and schema as the given table. The new table has no data in it. You can check the return value's isValid() method to determine whether the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [1/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWCString & sql ) const

Uses a default connection to create viewName in the database. The supplied sql is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [2/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWCString & sql,
const RWDBConnection & connection ) const

Uses the supplied connection to create viewName in the database. The supplied sql is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [3/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWDBSchema & columnList,
const RWCString & sql ) const

Uses a default connection to create viewName in the database. The supplied sql is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded. The resulting columns from the SELECT statement are named according to the columnList provided.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [4/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWDBSchema & columnList,
const RWCString & sql,
const RWDBConnection & connection ) const

Uses the supplied connection to create viewName in the database. The supplied sql is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded. The resulting columns from the SELECT statement are named according to the columnList provided. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [5/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWDBSchema & columnList,
const RWDBSelectorBase & select ) const

Uses a default connection to create viewName in the database. The SQL SELECT statement encapsulated in select is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded. The resulting columns from the SELECT statement are named according to the columnList provided.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [6/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWDBSchema & columnList,
const RWDBSelectorBase & select,
const RWDBConnection & connection ) const

Uses the supplied connection to create viewName in the database. The SQL SELECT statement encapsulated in select is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded. The resulting columns from the SELECT statement are named according to the columnList provided. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [7/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWDBSelectorBase & select ) const

Uses a default connection to create viewName in the database. The SQL SELECT statement encapsulated in select is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ createView() [8/8]

RWDBStatus RWDBDatabase::createView ( const RWCString & viewName,
const RWDBSelectorBase & select,
const RWDBConnection & connection ) const

Uses the supplied connection to create viewName in the database. The SQL SELECT statement encapsulated in select is used as the body of the new view. You can check the return value's isValid() method to determine whether the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ cursor() [1/12]

RWDBCursor RWDBDatabase::cursor ( const RWCString & select,
const RWDBSchema & updateCols,
const RWDBConnection & connection,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the given SQL SELECT statement. The cursorType may be RWDBCursor::Sequential, or RWDBCursor::Scrolling. The cursorAccess may be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on the supplied connection. The argument updateCols is used in building a clause:

FOR UPDATE OF column-name, column-name, ...

Some SQL dialects require this form. This function can behave asynchronously if executed using an asynchronous connection.

◆ cursor() [2/12]

RWDBCursor RWDBDatabase::cursor ( const RWCString & select,
const RWDBSchema & updateCols,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the given SQL SELECT statement. The cursorType may be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess may be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on the default connection. The argument updateCols is used in building a clause:

FOR UPDATE OF column-name, column-name, ...

Some SQL dialects require this form.

◆ cursor() [3/12]

RWDBCursor RWDBDatabase::cursor ( const RWCString & sql,
const RWDBConnection & connection,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the given sql. The cursorType may be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess may be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on the connection provided. The DB Interface Module does not check the contents of sql for validity. This function can behave asynchronously if executed using an asynchronous connection.

◆ cursor() [4/12]

RWDBCursor RWDBDatabase::cursor ( const RWCString & sql,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the given sql. The cursorType may be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess may be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on a default connection. The DB Interface Module does not check the contents of sql for validity.

◆ cursor() [5/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBCompoundSelector & select,
const RWDBConnection & connection,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType may be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess may be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on the supplied connection. This function can behave asynchronously if executed using an asynchronous connection.

◆ cursor() [6/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBCompoundSelector & select,
const RWDBSchema & updateCols,
const RWDBConnection & connection,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType can be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess can be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on the supplied connection. The argument updateCols is used in building a clause:

FOR UPDATE OF column-name, column-name, ...

Some SQL dialects require this form. This function can behave asynchronously if executed using an asynchronous connection.

◆ cursor() [7/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBCompoundSelector & select,
const RWDBSchema & updateCols,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType can be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess can be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on a default connection. The argument updateCols is used in building a clause:

FOR UPDATE OF column-name, column-name, ...

Some SQL dialects require this form.

◆ cursor() [8/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBCompoundSelector & select,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType can be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess can be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on a default connection.

◆ cursor() [9/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBSelector & select,
const RWDBConnection & connection,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType can be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess can be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on the supplied connection. This function can behave asynchronously if executed using an asynchronous connection.

◆ cursor() [10/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBSelector & select,
const RWDBSchema & updateCols,
const RWDBConnection & connection,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType can be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess can be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on the supplied connection. The argument updateCols is used in building a clause:

FOR UPDATE OF column-name, column-name, ...

Some SQL dialects require this form. This function can behave asynchronously if executed using an asynchronous connection.

◆ cursor() [11/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBSelector & select,
const RWDBSchema & updateCols,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType can be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess can be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on a default connection. The argument updateCols is used in building a clause:

FOR UPDATE OF column-name, column-name, ...

Some SQL dialects require this form.

◆ cursor() [12/12]

RWDBCursor RWDBDatabase::cursor ( const RWDBSelector & select,
RWDBCursor::CursorType cursorType = RWDBCursor::Sequential,
RWDBCursor::CursorAccess cursorAccess = RWDBCursor::Read ) const

Produces an RWDBCursor for execution of the SQL SELECT statement encapsulated in select. The cursorType can be either RWDBCursor::Sequential or RWDBCursor::Scrolling. The cursorAccess can be either RWDBCursor::Read or RWDBCursor::Write. The cursor is created on a default connection.

◆ dateVector()

RWDBDateVector RWDBDatabase::dateVector ( size_t n) const
Deprecated
As of SourcePro 6, use class RWDBTBuffer instead of RWDBDateVector.

Produces an RWDBDateVector of size n with RWDBVendorDate objects appropriate for use with self's underlying implementation.

◆ dbName()

RWCString RWDBDatabase::dbName ( ) const

Returns the name of the database used when constructing self. See RWDBManager for more information.

DB XA Module: Returns an empty string.

◆ dbStoredProcedures() [1/6]

RWDBTable RWDBDatabase::dbStoredProcedures ( ) const

Returns, as an RWDBTable, a list of stored procedures available in the database encapsulated by self. The table contains two columns, name and owner, whose data type is String. Each row in the returned table contains information about a single database object.

◆ dbStoredProcedures() [2/6]

RWDBTable RWDBDatabase::dbStoredProcedures ( const RWCString & name,
AdjustCaseType adjustCase = Normalize ) const

Returns, as an RWDBTable, a list of stored procedures available in the database encapsulated by self. The table contains two columns, name and owner, whose data type is String. Each row in the returned table contains information about a single database object.

Parameters
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
adjustCaseSpecifies whether the search value name should be normalized.

◆ dbStoredProcedures() [3/6]

RWDBTable RWDBDatabase::dbStoredProcedures ( const RWCString & name,
const RWCString & owner,
AdjustCaseType adjustCase = Normalize ) const

Returns, as an RWDBTable, a list of stored procedures available in the database encapsulated by self. The table contains two columns, name and owner, whose data type is String. Each row in the returned table contains information about a single database object.

Parameters
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
ownerRestricts the search to tables with matching owners, according to the SQL LIKE operator. A blank owner places no restrictions on the search.
adjustCaseSpecifies whether the search values name and owner should be normalized.

◆ dbStoredProcedures() [4/6]

RWDBTable RWDBDatabase::dbStoredProcedures ( const RWDBConnection & conn) const

Returns, as an RWDBTable, a list of stored procedures available in the database encapsulated by self. The table contains two columns, name and owner, whose data type is String. Each row in the returned table contains information about a single database object. The query is issued through the supplied conn. This function can behave asynchronously if executed using an asynchronous connection.

Parameters
connDatabase connection to be used for this query.

◆ dbStoredProcedures() [5/6]

RWDBTable RWDBDatabase::dbStoredProcedures ( const RWDBConnection & conn,
const RWCString & name,
AdjustCaseType adjustCase = Normalize ) const

Returns, as an RWDBTable, a list of stored procedures available in the database encapsulated by self. The table contains two columns, name and owner, whose data type is String. Each row in the returned table contains information about a single database object. The query is issued through the supplied conn. This function can behave asynchronously if executed using an asynchronous connection.

Parameters
connDatabase connection to be used for this query.
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
adjustCaseSpecifies whether the search value name should be normalized.

◆ dbStoredProcedures() [6/6]

RWDBTable RWDBDatabase::dbStoredProcedures ( const RWDBConnection & conn,
const RWCString & name,
const RWCString & owner,
AdjustCaseType adjustCase = Normalize ) const

Returns, as an RWDBTable, a list of stored procedures available in the database encapsulated by self. The table contains two columns, name and owner, whose data type is String. Each row in the returned table contains information about a single database object. The query is issued through the supplied conn. This function can behave asynchronously if executed using an asynchronous connection.

Parameters
connDatabase connection to be used for this query.
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
ownerRestricts the search to tables with matching owners, according to the SQL LIKE operator. A blank owner places no restrictions on the search.
adjustCaseSpecifies whether the search values name and owner should be normalized.

◆ dbTables() [1/6]

RWDBTable RWDBDatabase::dbTables ( const RWCString & name,
const RWCString & owner,
int type = SystemTable|UserTable|View|Synonym,
AdjustCaseType adjustCase = Normalize ) const

Like an RWDBTable, returns a list of tables stored in the database encapsulated by self. The table contains three columns, name, owner, and type, whose data types are String, String, and Int, respectively.

Each row in the returned table contains information about a single database object. The search is restricted to tables of those types that make up type. If the default argument is used, this method returns all tables encapsulated by self.

Parameters
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
ownerRestricts the search to tables with matching owners, according to the SQL LIKE operator. A blank owner places no restrictions on the search.
typeConsists of the bitwise ORed combination of the enumerated values UserTable, SystemTable, View, and Synonym.
adjustCaseSpecifies whether the search values name and owner should be normalized.

◆ dbTables() [2/6]

RWDBTable RWDBDatabase::dbTables ( const RWCString & name,
int type = SystemTable|UserTable|View|Synonym,
AdjustCaseType adjustCase = Normalize ) const

Like an RWDBTable, returns a list of tables stored in the database encapsulated by self. The table contains three columns, name, owner, and type, whose data types are String, String, and Int, respectively.

Each row in the returned table contains information about a single database object. The search is restricted to tables of those types that make up type. If the default argument

is used, this method returns all tables encapsulated by self.

Parameters
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
typeConsists of the bitwise ORed combination of the enumerated values UserTable, SystemTable, View, and Synonym.
adjustCaseSpecifies whether the search value name should be normalized.

◆ dbTables() [3/6]

RWDBTable RWDBDatabase::dbTables ( const RWDBConnection & conn,
const RWCString & name,
const RWCString & owner,
int type = SystemTable|UserTable|View|Synonym,
AdjustCaseType adjustCase = Normalize ) const

Like an RWDBTable, returns a list of tables stored in the database encapsulated by self. The table contains three columns, name, owner, and type, whose data types are String, String, and Int, respectively.

Each row in the returned table contains information about a single database object. The search is restricted to tables of those types that make up type. If the default argument is used, this method returns all tables encapsulated by self. The query is issued through the supplied conn. This function can behave asynchronously if executed using an asynchronous connection.

Parameters
connDatabase connection to be used for this query.
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
ownerRestricts the search to tables with matching owners, according to the SQL LIKE operator. A blank owner places no restrictions on the search.
typeConsists of the bitwise ORed combination of the enumerated values UserTable, SystemTable, View, and Synonym.
adjustCaseSpecifies whether the search values name and owner should be normalized.

◆ dbTables() [4/6]

RWDBTable RWDBDatabase::dbTables ( const RWDBConnection & conn,
const RWCString & name,
int type = SystemTable|UserTable|View|Synonym,
AdjustCaseType adjustCase = Normalize ) const

Like an RWDBTable, returns a list of tables stored in the database encapsulated by self. The table contains three columns, name, owner, and type, whose data types are String, String, and Int, respectively.

Each row in the returned table contains information about a single database object. The search is restricted to tables of those types that make up type. If the default argument is used, this method returns all tables encapsulated by self. The query is issued through the supplied conn. This function can behave asynchronously if executed using an asynchronous connection.

Parameters
connDatabase connection to be used for this query.
nameRestricts the search to tables with matching names, according to the SQL LIKE operator. A blank name places no restrictions on the search.
typeConsists of the bitwise ORed combination of the enumerated values UserTable, SystemTable, View, and Synonym.
adjustCaseSpecifies whether the search value name should be normalized.

◆ dbTables() [5/6]

RWDBTable RWDBDatabase::dbTables ( const RWDBConnection & conn,
int type = SystemTable|UserTable|View|Synonym ) const

Like an RWDBTable, returns a list of tables stored in the database encapsulated by self. The table contains three columns, name, owner, and type, whose data types are String, String, and Int, respectively. Each row in the returned table contains information about a single database object.

The search is restricted to tables of those types that make up type. If the default argument is used, this method returns all tables encapsulated by self. The query is issued through the supplied conn. This function can behave asynchronously if executed using an asynchronous connection.

Parameters
connDatabase connection to be used for this query.
typeConsists of the bitwise ORed combination of the enumerated values UserTable, SystemTable, View, and Synonym.

◆ dbTables() [6/6]

RWDBTable RWDBDatabase::dbTables ( int type = SystemTable|UserTable|View|Synonym) const

Like an RWDBTable, returns a list of tables stored in the database encapsulated by self. The table contains three columns, name, owner, and type, whose data types are String, String, and Int, respectively.

Each row in the returned table contains information about a single database object. The search is restricted to tables of those types that make up type. If the default argument is used, this method returns all tables encapsulated by self.

Parameters
typeConsists of the bitwise ORed combination of the enumerated values UserTable, SystemTable, View, and Synonym.

◆ defaultConnections() [1/2]

size_t RWDBDatabase::defaultConnections ( ) const

Returns the number of default connections retained in self's connection pool. Initially, the number of default connections is set to 1. Each database maintains a pool of connections from which all requests for explicit and implicit connections are satisfied. Optimizing the number of default connections can significantly boost performance when using implicit connections.

See also
totalConnections().

DB XA Module: The number of default connections is always 1, except with the DB Access Module for Sybase, where the connection pool is disabled and this method always returns 0.

◆ defaultConnections() [2/2]

size_t RWDBDatabase::defaultConnections ( size_t size)

Sets the number of default connections retained in self's connection pool to size. Each database maintains a pool of connections from which all requests for explicit and implicit connections are satisfied. This method allows applications to change the number of default connections to retain as they are returned to the connection pool.

Increasing or decreasing the number of default connections does not immediately enlarge or shrink the connection pool, but affects only the number of default connections. The total size of the connection pool changes as connections are created and destroyed, and the requested number of default connections are retained.

This method returns the previous number of default connections retained. Initially, the number of default connections is set to 1. Optimizing the number of default connections can significantly boost performance when using implicit connections. Also see totalConnections().

DB XA Module: The number of default connections is restricted to 1, so using this method to set a higher number does nothing. The exception is the DB Access Module for Sybase, where the connection pool is disabled so use of this method results in an RWDBStatus::notSupported error.

◆ deleter() [1/2]

RWDBDeleter RWDBDatabase::deleter ( const RWDBTable & table) const

Produces an RWDBDeleter which encapsulates the SQL statement:

DELETE FROM table

The deleter can be used to delete all the data from the database table represented by table, or can be augmented with an RWDBCriterion representing an SQL WHERE clause in order to delete data selectively.

◆ deleter() [2/2]

RWDBDeleter RWDBDatabase::deleter ( const RWDBTable & table,
const RWDBCriterion & criterion ) const

Produces an RWDBDeleter that encapsulates the SQL statement:

DELETE FROM table WHERE criterion

The deleter can be used to delete rows that meet the given criterion representing an SQL WHERE clause, from the database table represented by table. Note that a subsequent call to RWDBDeleter::where() on the produced RWDBDeleter object replaces the criterion, rather than adding to it.

◆ dropView() [1/2]

RWDBStatus RWDBDatabase::dropView ( const RWCString & viewName)

Uses a default connection to drop viewName from the database. You can check the return value's isValid() method to determine whether or not the operation succeeded.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ dropView() [2/2]

RWDBStatus RWDBDatabase::dropView ( const RWCString & viewName,
const RWDBConnection & connection )

Uses the supplied connection to drop viewName from the database. You can check the return value's isValid() method to determine whether or not the operation succeeded. This function can behave asynchronously if executed using an asynchronous connection.

DB XA Module: May generate a server error. This method can still be used before XA connectivity is established.

◆ emptyStringIsNull()

bool RWDBDatabase::emptyStringIsNull ( ) const

Retrieves the setting of this flag for this instance of RWDBDatabase. See RWDBManager::emptyStringIsNull(bool) for details.

◆ environmentHandle()

RWDBEnvironmentHandle * RWDBDatabase::environmentHandle ( ) const

Returns the handle to the environment. Through the environment handle, the user can set environment-specific values. Should be used before a connection is established. See RWDBEnvironmentHandle for more information.

◆ errorHandler()

RWDBStatus::ErrorHandler RWDBDatabase::errorHandler ( ) const

Returns the currently-installed error handler, if any.

◆ inserter() [1/6]

RWDBInserter RWDBDatabase::inserter ( const RWDBTable & table,
const RWDBCompoundSelector & selector ) const

Produces an RWDBInserter which encapsulates the SQL statement:

INSERT INTO table select-statement

where the select-statement is encapsulated by the given selector.

◆ inserter() [2/6]

RWDBInserter RWDBDatabase::inserter ( const RWDBTable & table,
const RWDBCompoundSelector & selector,
const RWDBSchema & columnList ) const

Produces an RWDBInserter that encapsulates the SQL statement:

INSERT INTO table(col1, ..., coln) select-statement

The names of the column entries in schema are used to build up the column-name list. The select-statement is encapsulated by the given selector.

◆ inserter() [3/6]

RWDBInserter RWDBDatabase::inserter ( const RWDBTable & table,
const RWDBSchema & columnList,
size_t cache = 1 ) const

Produces an RWDBInserter that encapsulates the SQL statement:

INSERT INTO table(col1, ..., coln) VALUES(val1, ..., valn)

The names of the column entries in schema are used to build up the column-name list. When cache is passed in as 0, it is interpreted as 1.

Note
When using Access Modules that support an inserter cache, increasing the cache value can greatly improve performance. However, setting the cache parameter greater than one may adversely affect transactions. Check your Access Module documentation for limitations and warnings.

◆ inserter() [4/6]

RWDBInserter RWDBDatabase::inserter ( const RWDBTable & table,
const RWDBSelector & selector ) const

Produces an RWDBInserter that encapsulates the SQL statement:

INSERT INTO table select-statement

where the select-statement is encapsulated by the given selector.

◆ inserter() [5/6]

RWDBInserter RWDBDatabase::inserter ( const RWDBTable & table,
const RWDBSelector & selector,
const RWDBSchema & columnList ) const

Produces an RWDBInserter that encapsulates the SQL statement:

INSERT INTO table(col1, ..., coln) select-statement

The names of the column entries in schema are used to build up the column-name list. The select-statement is encapsulated by the given selector.

◆ inserter() [6/6]

RWDBInserter RWDBDatabase::inserter ( const RWDBTable & table,
size_t cache = 1 ) const

Produces an RWDBInserter that encapsulates the SQL statement:

INSERT INTO table VALUES ...

where the actual values must be added to the inserter later. When cache is passed in as 0, it is interpreted as 1.

Note
When using Access Modules that support an inserter cache, increasing the cache value can greatly improve performance. However, setting the cache parameter greater than one may adversely affect transactions. Check your Access Module documentation for limitations and warnings.

◆ isReady()

bool RWDBDatabase::isReady ( ) const

Returns true if the object is in ready state, indicating that accessing the object will not block. Accessing a nonready object may potentially block.

◆ isValid()

bool RWDBDatabase::isValid ( ) const

Returns true if self's status is RWDBStatus::ok, otherwise false.

◆ memTable() [1/2]

RWDBMemTable RWDBDatabase::memTable ( const RWCString & name,
const RWDBConnection & connection,
size_t capacity = 0 ) const

Produces an RWDBMemTable with the given name. The given connection is used to query the database for a table matching name. If one is found, the RWDBMemTable is populated with rows of data from the database. If capacity is zero, all rows are fetched into the RWDBMemTable. Otherwise a maximum of capacity rows is fetched.

◆ memTable() [2/2]

RWDBMemTable RWDBDatabase::memTable ( const RWCString & name,
size_t capacity = 0 ) const

Produces an RWDBMemTable with the given name. A default connection is used to query the database for a table matching name. If one is found, the RWDBMemTable is populated with rows of data from the database. If capacity is zero, all rows are fetched into the RWDBMemTable, otherwise a maximum of capacity rows is fetched.

◆ operator!=()

bool RWDBDatabase::operator!= ( const RWDBDatabase & dbase) const

Returns true if self and dbase do not share the same implementation, otherwise false.

◆ operator=()

RWDBDatabase & RWDBDatabase::operator= ( const RWDBDatabase & dbase)

Assignment operator. Self shares an implementation with dbase. Returns a reference to self.

◆ operator==()

bool RWDBDatabase::operator== ( const RWDBDatabase & dbase) const

Returns true if self and dbase share the same implementation, otherwise false.

◆ passWord() [1/2]

RWCString RWDBDatabase::passWord ( ) const

Returns the password of the user passed in when constructing self. See RWDBManager for more information.

DB XA Module: Returns an empty string.

◆ passWord() [2/2]

RWCString RWDBDatabase::passWord ( const RWCString & pwd)

Updates self's password to pwd. Database connections obtained after this call will use the new password. Returns the old password.

◆ phraseBook()

const RWDBPhraseBook & RWDBDatabase::phraseBook ( ) const

Returns a reference to self's RWDBPhraseBook.

◆ release()

void RWDBDatabase::release ( void ) const

Releases a previously acquired mutex. This function can be called from a const object.

Note
In single-threaded builds, this function evaluates to a no-op.

◆ selector() [1/2]

RWDBSelector RWDBDatabase::selector ( ) const

Produces an empty RWDBSelector appropriate for this database. The result can be used to build an encapsulated SQL SELECT statement. See RWDBSelector for details.

◆ selector() [2/2]

RWDBSelector RWDBDatabase::selector ( const RWDBCriterion & criterion) const

Produces an RWDBSelector whose criterion, or WHERE clause, is initialized with the given criterion. The result can be used to build an encapsulated SQL SELECT statement. See RWDBSelector for details. Note that a subsequent call to RWDBSelector::where() on the produced RWDBSelector object replaces criterion, rather than adds to it.

◆ serverName()

RWCString RWDBDatabase::serverName ( ) const

Returns the name of the server used when constructing self. See RWDBManager for more information.

DB XA Module: Returns an empty string.

◆ serverType()

RWCString RWDBDatabase::serverType ( ) const

Returns a mnemonic based on the Access Module you are using. This is the same as the string you use for the accessLib parameter of RWDBManager::database() for static libraries, as described in your DB Access Module guide. Specifically, it is not the same as the accessLib parameter for dynamic libraries.

◆ setErrorHandler()

void RWDBDatabase::setErrorHandler ( RWDBStatus::ErrorHandler handler)

Installs handler as the error handler for self. The supplied handler is called whenever the status of self changes to anything except RWDBStatus::ok. By default, the error handler of self is inherited from the RWDBManager; this method overrides the default.

◆ status()

RWDBStatus RWDBDatabase::status ( ) const

Returns the current status of self.

◆ storedProc() [1/4]

RWDBStoredProc RWDBDatabase::storedProc ( const RWCString & name) const

Produces an RWDBStoredProc. The result represents the stored procedure with the given name in the database. If a cache manager is present, this method checks the cache for a schema. If it isn't found or a cache manager isn't present, uses a default connection to retrieve information about the stored procedure's parameters. If a cache manager is present, the stored procedure metadata fetched from the database is stored in the cache.

◆ storedProc() [2/4]

RWDBStoredProc RWDBDatabase::storedProc ( const RWCString & name,
const RWDBConnection & connection ) const

Produces an RWDBStoredProc. The result represents the stored procedure with the given name in the database. If a cache manager is present, this method checks the cache for a schema. If it isn't found or a cache manager isn't present, uses the supplied connection to retrieve information about the stored procedure's parameters. If a cache manager is present, the stored procedure metadata fetched from the database is stored in the cache.

◆ storedProc() [3/4]

RWDBStoredProc RWDBDatabase::storedProc ( const RWCString & name,
const RWDBConnection & connection,
const RWDBSchema & sch,
const RWDBColumn & col = RWDBColumn(),
const RWCString & text = RWCString() ) const

Produces an RWDBStoredProc. The result represents the stored procedure with the given name in the database. Uses the supplied RWDBSchema to determine the parameters in the stored procedure, the supplied column to determine the return value, if any, and the supplied RWCString to determine the text. If text is an empty string, the next call to RWDBStoredProc::text() will attempt to fetch the text. This means that the call does not have to query the database for the parameters needed or the return value, so the connection is not used. If a cache manager is present, the schema and column are stored in the cache, replacing any existing metadata present in the cache. If the text is not empty, it too is stored in the cache.

Note
The return value definition col must have a valid RWDBValue::type() and any appropriate RWDBColumn::storageLength(), RWDBColumn::scale() and RWDBColumn::precision() information.
The connection parameter is currently not used.

◆ storedProc() [4/4]

RWDBStoredProc RWDBDatabase::storedProc ( const RWCString & name,
const RWDBSchema & sch,
const RWDBColumn & col = RWDBColumn(),
const RWCString & text = RWCString() ) const

Produces an RWDBStoredProc. The result represents the stored procedure with the given name in the database. Uses the supplied RWDBSchema to determine the parameters in the stored procedure, the supplied column to determine the return value, if any, and the supplied RWCString to determine the text. If text is an empty string, the next call to RWDBStoredProc::text() will attempt to fetch the text. This means that the call does not have to query the database for the parameters needed or the return value. If a cache manager is present, the schema and column are stored in the cache, replacing any existing metadata present in the cache. If the text is not empty, it too is stored in the cache.

Note
The return value definition col must have a valid RWDBValue::type() and any appropriate RWDBColumn::storageLength(), RWDBColumn::scale() and RWDBColumn::precision() information.

◆ table() [1/3]

RWDBTable RWDBDatabase::table ( const RWCString & name) const

Produces an RWDBTable with the given name. The returned object is an instance of a database table, which applications are likely to need most often. See RWDBTable for an explanation of the different kinds of RWDBTable objects.

Each RWDBTable that is produced has a unique alias. When producing a table that will be used for self-joins, this may or may not be desirable. Exact copies of a table and associated tags should be produced by RWDBTable::operator=() or copy constructor.

◆ table() [2/3]

RWDBTable RWDBDatabase::table ( const RWCString & name,
const RWDBSchema & schema,
bool isView = false ) const

Produces an RWDBTable with the given name. The returned object is an instance of a database table. The supplied schema is used as the table's schema. If isView is true, it is assumed that the table represents a database view. If a cache manager is present, schema and isView are stored in the cache, replacing any existing schema and isView information stored in the cache. See RWDBTable for an explanation of the different kinds of RWDBTable objects.

Each RWDBTable that is produced has a unique alias. When producing a table that will be used for self-joins, this may or may not be desirable. Exact copies of a table and associated tags should be produced by RWDBTable::operator=() or copy constructor. It is assumed that the contents of the supplied schema are correct for the named RWDBTable. If not, the program may produce unexpected results.

Note
The schema schema passed to construct an RWDBTable object is assumed to be complete with pertinent metadata information.

◆ table() [3/3]

RWDBTable RWDBDatabase::table ( const RWDBSelectorBase & selector) const

Produces an RWDBTable representing the SQL query encapsulated by selector. The returned object is an instance of a derived table. See RWDBTable for an explanation of the different kinds of RWDBTable objects. The returned RWDBTable has a unique alias.

◆ timeZone() [1/2]

const RWZone & RWDBDatabase::timeZone ( ) const

Returns a reference to the time zone set on self. If the time zone is not set, returns RWZone::local().

See also
timeZone(const RWZone*) for setting the time zone.
RWDBConnection::timeZone(const RWZone*) for information on how the time zone setting is used.
Note
This method does not fetch the time zone set on the database server or the database client.

◆ timeZone() [2/2]

const RWZone * RWDBDatabase::timeZone ( const RWZone * zone)

Sets self's time zone to zone. All explicit and implicit RWDBConnection objects produced from self inherit the time zone setting at the time they are produced.

Parameters
zoneThe time zone to be set on self. Pass NULL to unset the time zone setting.
Returns
The previous time zone set on self. Returns NULL when the time zone was not set.
See also
RWDBConnection::timeZone(const RWZone*) for information on how the time zone setting is used.
Note
Self retains a reference to zone. It is the application's responsibility to ensure that zone has a lifetime greater than self or any object produced from self.
This method does not set the time zone on the database server or the database client.

◆ totalConnections()

size_t RWDBDatabase::totalConnections ( ) const

Returns the total number of connections an application is using or has retained in the connection pool.

See also
defaultConnections().

◆ tracer()

RWDBTracer & RWDBDatabase::tracer ( )

Returns a reference to self's RWDBTracer. The result can be used to control trace output from this RWDBDatabase. See RWDBTracer for an explanation of tracing capabilities.

◆ updater() [1/2]

RWDBUpdater RWDBDatabase::updater ( const RWDBTable & table) const

Produces an RWDBUpdater. The result can be used to create an encapsulated SQL UPDATE statement to update rows in the database table represented by table.

◆ updater() [2/2]

RWDBUpdater RWDBDatabase::updater ( const RWDBTable & table,
const RWDBCriterion & criterion ) const

Produces an RWDBUpdater whose criterion (WHERE clause) is initialized with the given criterion. The result can be used to create an encapsulated SQL UPDATE statement to update rows in the database table represented by table. Note that a subsequent call to RWDBUpdater::where() on the produced RWDBUpdater object replaces criterion, rather than adds to it.

◆ userName()

RWCString RWDBDatabase::userName ( ) const

Returns the user name passed in when constructing self. See RWDBManager for more information.

DB XA Module: Returns an empty string.

◆ verboseAsString() [1/2]

bool RWDBDatabase::verboseAsString ( ) const

Accessor function that returns self's verboseAsString setting.

The value of this member affects the SQL returned by the asString() methods of the RWDBInserter, RWDBUpdater, RWDBDeleter, RWDBSelector, and RWDBCompoundSelector instances produced by this RWDBDatabase.

  • If the verboseAsString setting is set to false, the asString() methods of the above classes return the SQL as sent to the database for execution, meaning that it may include placeholders.
  • If the verboseAsString setting is set to true, the asString() methods of the above classes return the SQL with the placeholders replaced by their bound values.

◆ verboseAsString() [2/2]

bool RWDBDatabase::verboseAsString ( bool verbose)

Sets self's verboseAsString setting to verbose and returns its previous value. The default value is false.

The value of this member affects the SQL returned by the asString() methods of the RWDBInserter, RWDBUpdater, RWDBDeleter, RWDBSelector, and RWDBCompoundSelector instances produced by this RWDBDatabase.

  • If the verboseAsString setting is set to false, the asString() methods of the above classes return the SQL as sent to the database for execution, meaning that it may include placeholders.
  • If the verboseAsString setting is set to true, the asString() methods of the above classes will return the SQL with the placeholders replaced by their bound values.
Note
Setting the verboseAsString setting to true enables the asString() methods to return SQL in which placeholders are replaced by their bound values, but it does not affect the SQL passed to the database for execution.

◆ version()

RWCString RWDBDatabase::version ( ) const

Returns a string that identifies the version number of the DB Interface Module and the DB Access Module being used.

Friends And Related Symbol Documentation

◆ rwdbAllTypes

#define rwdbAllTypes
related

The default value for the type argument to dbTables().

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