Member Functions | |||
database() |
errorHandler() |
setErrorHandler() |
version() |
#include <rw/db/dbmgr.h>RWDBDatabase myDbase = RWDBManager::database("myDbaseType", "myDbaseServerName", "myLoginName", "myPassword", "myDbaseName");
There is a single, global RWDBManager in charge of producing RWDBDatabases 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. This method may reside in a dynamically-linked library, or may be statically linked with a specialized object. In the former case, the method is identified by a conventional name, rwdbNewDatabaseImp, with any ambiguity alleviated by the containing library. In the latter case, each method must be uniquely named, as in rwdbNewSybaseDatabaseImp, for example. The association between method names and database types is made at link time via static initialization.
When presented with a request for a particular type of database implementation, the RWDBManager consults its set of known implementations. If no entry is found, and the operating environment supports dynamic linking, a search is made for a dynamically-linked library (DLL) whose name matches the requested type. If a DLL is found, it is loaded, the conventionally-named method is located, and the association is added to the set of implementations of the RWDBManager. Once an entry is located, its method is invoked to obtain an implementation of the requested type, a connection is established, and the result is returned to the caller. If no entry is found, the object returned to the caller has a status of RWDBStatus::notFound.
static RWDBDatabase database(const RWCString& accessLib, const RWCString& serverName, const RWCString& userName, const RWCString& passWord, const RWCString& databaseName);
Produces an RWDBDatabase. The first argument lets DBTools.h++ identify the kind of database being requested. The remaining arguments 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 accessLib. Your DBTools.h++ access library guide explains the values you must supply to obtain RWDBDatabases from your library.
static RWDBStatus::ErrorHandler errorHandler() const;
Retrieves the error handler currently installed in the RWDBManager, if any.
static RWDBStatus::ErrorHandler setErrorHandler(RWDBStatus::ErrorHandler handler);
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. The errorHandler is declared as a typedef within the scope of RWDBStatus:
typedef void (*ErrorHandler)(const RWDBStatus&);
static RWCString version();
Returns a string that identifies the version of the DBTools.h++ core library in which self resides. Note: this method identifies the version of the DBTools.h++ core library, while RWDBDatabase::version() identifies the version of a DBTools.h++ access library.
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.