DbBase Class Reference
[Public API]

This is base object for Database, DbConnection and DbResult classes. More...

#include <database.h>

Inheritance diagram for DbBase:

Inheritance graph
[legend]
Collaboration diagram for DbBase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DbBase ()
 Constructor.
DbBasegetParentErrorHandler () const
 Get parent error handler or NULL if not set.
void handleError (int pErrorType, const char *pMsg) const
 Handles error from database backend.
void setErrorHandler (void *pOwner, errorHandlerFunc pFunc)
 Sets new error handler.
void setParentErrorHandler (DbBase *pParent)
 Sets parent error handler.
 ~DbBase ()
 Destructor.

Protected Attributes

std::set< DbBase * > mChildren
 list of child error handlers
errorHandlerFunc mErrorHandler
 Custom error handling function.
void * mObj
 pointer to data that is passed to custom error handing function
DbBasemParent
 pointer to parent error handler

Detailed Description

This is base object for Database, DbConnection and DbResult classes.

It contains error handling routines and inherits conversion specification for converting data between database and application.

Database plugins can create multiple DbConnections and those connections can create multiple DbResult objects. When there is an error during data processing and current object cannot handle that error it should propagated up in this tree structure. This class contains pointers that forms tree allowing errors to be propagated from DbResult to DbConnection and up to Database objects. Error is propagated only if current DbBase object don't have error handling callback or calling this callback returned false. In both cases parent DbBase object is tried. If there is no parent handler and callback function is NULL then error message is printer to stderr.

Conversion specification data should copied when child object is created. It is plugin responsibility to copy this data from Database derived class to DbConnection when DbConnection is created and from DbConnection to DbResult.


Member Function Documentation

void handleError int  pErrorType,
const char *  pMsg
const
 

Handles error from database backend.

Default implementation prints errors on stderr

Parameters:
pErrorType type of error
pMsg error message from database backend

void setErrorHandler void *  pOwner,
errorHandlerFunc  pFunc
 

Sets new error handler.

Parameters:
pOwner this pointer will be passed to errorHandlerFunc as pObj
pFunc user suppiled error handling routine

void setParentErrorHandler DbBase pParent  ) 
 

Sets parent error handler.

Parent error handler will be tried if this error handler cannot handle error (callback function is NULL or returns false)

Parameters:
pParent parent error handler

Member Data Documentation

errorHandlerFunc mErrorHandler [protected]
 

Custom error handling function.

Called instead of default handleError function


The documentation for this class was generated from the following file:

Documentation
Quick start
Examples
Search

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Sun Nov 9 02:08:19 2008