All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEPData Namespace Reference

Offers a database access subsystem. More...

Classes

class  DB
 Data subsystem initialization. More...
 
struct  DBMetadataField
 Describes each field within a database operation. More...
 
class  CycleBase
 A Cycle is a special type of class that permits to execute a method for each one of the elements returned on a query operation, maintaining a state that will survive each one of these executions. More...
 
class  NullCycle
 Particular Cycle type doing nothing. More...
 
class  QueryUniqueCycle
 Particular Cycle for usage when a query will only return one row. More...
 
class  DBResultSet
 The result of a query operation. More...
 
class  DBStatement
 Defines the operation that will be performed by the database. More...
 
class  DBEnvironment
 This is, basically, a database session. More...
 
class  DBException
 Extension to describe DBBase exceptions. More...
 
class  DBDrvLib
 
class  DBEnvironmentQueue
 Offers a queue-like storage for a DBEnvironment session pools. More...
 
class  DBStatementCatalog
 Offers a database statement catalog that will be used by the database infrastructure to manage reusable SQL statement definitions. More...
 
class  QueryRunner
 The general statement executor or (runner). More...
 

Typedefs

typedef Array< DBMetadataFieldDBMetadata
 As an array of DBMetadataField elements, it will keep the information related with each database operation for internal processing.
 
typedef function< bool(DBResultSet
*pResultSetPtr, bool pIsFirst,
bool pIsLast)> 
ExecuteFunctionType
 Prototype function to be used when it is not necessary to store states (for that use the Cycle classes.
 
typedef string(* WhatMethod )(string &pMessageRef, exception *pExceptPtr)
 
typedef map< string, DBDrvLib * > DBDrvLibMap
 Basic DBDrvLib STL dictionary.
 
typedef DBDrvLibMap::iterator DBDrvLibMapIterator
 A DBDrvLib iterator.
 
typedef list< DBEnvironment * > DBEnvironmentList
 
typedef DBEnvironmentList::iterator DBEnvironmentListIterator
 
typedef DBEnvironment *(* environmentCreatorType )()
 
typedef map< string,
DBEnvironmentQueue * > 
DBEnvironmentQueueMap
 
typedef
DBEnvironmentQueueMap::iterator 
DBEnvironmentQueueMapIterator
 
typedef list< DBTypeDBTypeList
 datatype list to use as reference
 
typedef pair< DBType, string > DBParameter
 parameter type and a string value
 
typedef vector< DBParameterDBParameters
 parameter vector to pass to methods
 

Enumerations

enum  DBType {
  DBT_Null = 0, DBT_Number = 1, DBT_String = 2, DBT_Float = 3,
  DBT_Binary = 4
}
 Data types can be used as parameters when running SQL operations. More...
 

Functions

string & BaseWhatMethod (string &pMessageRef, exception *pExceptionPtr)
 

Detailed Description

Offers a database access subsystem.

This subsystem includes the following characteristics:

  • Basic embedded security
  • Multiple concurrent dbms access
  • Session pool
  • Heterogeneous synchronization capacity
  • Easy pool configuration
  • Concept separation statement/execution (non wired sentences)

The database sentences are pre-stored and they are prepared without direct string manipulation. This provides flexibility because each particular statement is separated from the compiled program, and security because no string concatenation is performed so, it limits the possibility to have SQL injection problems.

The subsystem/engine loads all available drivers and perform all the database connections are stored in the corresponding pool configurations. Any application using this engine can use any of the available resources for the required purpose.

The QueryRunner acquires and releases sessions from the session pool automatically and even have the capacity to make a "one-time" connection embedded engine as SQLite to behave as a multi-user concurrent engine.

Each statement is stored in an independent .sql text file. If the file has the prefix "SYNC-", the engine will create a parameters file with enough data for an external application to read it and to send to another engine located in another computer. As these engines can manage different types of dbms, it is possible to define a synchronization between normally incompatible database systems. For example, a MySQL dbms could synchronize to a SQLite embedded system for backup purposes, so will reduce the cost and complexity for a complete synchronization system based on one vendor offering.

The pool configuration is defined with one file

DBType=SqLite
ConnString=/pathTo/DatabaseFile.sqlite
User=username
Password=password
Schema=test #this has no effect with SqLite driver
Instances=1 #in this case only one connection can be used
SyncTo=MyOtherServer
SyncPath=/pathTo/SyncFiles/

This file is enough to control many threads accessing the database in a concurrent/safe way.

Todo:
To store the credentials in a safe place (for example, a Hardware Security Module); The DBEnvironment connect method has related comments.

Typedef Documentation

typedef map<string,DBDrvLib*> HSEPData::DBDrvLibMap

Basic DBDrvLib STL dictionary.

In version 0.2 this will be modified to match the HSEP base driver behavior.

Definition at line 119 of file DBDrvLib.h.

typedef DBDrvLibMap::iterator HSEPData::DBDrvLibMapIterator

A DBDrvLib iterator.

In version 0.2 this will be modified to match the HSEP base driver behavior and the HSEP etiquette definitions.

Definition at line 127 of file DBDrvLib.h.

Definition at line 35 of file DBEnvironmentQueue.h.

typedef DBEnvironmentList::iterator HSEPData::DBEnvironmentListIterator

Definition at line 36 of file DBEnvironmentQueue.h.

Definition at line 76 of file DBEnvironmentQueue.h.

typedef DBEnvironmentQueueMap::iterator HSEPData::DBEnvironmentQueueMapIterator

Definition at line 77 of file DBEnvironmentQueue.h.

As an array of DBMetadataField elements, it will keep the information related with each database operation for internal processing.

Definition at line 67 of file DBBase.h.

typedef pair<DBType,string> HSEPData::DBParameter

parameter type and a string value

Definition at line 44 of file DBTypes.h.

parameter vector to pass to methods

Definition at line 45 of file DBTypes.h.

datatype list to use as reference

Definition at line 43 of file DBTypes.h.

typedef DBEnvironment*(* HSEPData::environmentCreatorType)()

Definition at line 37 of file DBEnvironmentQueue.h.

typedef function<bool (DBResultSet* pResultSetPtr, bool pIsFirst, bool pIsLast)> HSEPData::ExecuteFunctionType

Prototype function to be used when it is not necessary to store states (for that use the Cycle classes.

It is possible to define named or lanbda functions.

Definition at line 167 of file DBBase.h.

typedef string(* HSEPData::WhatMethod)(string &pMessageRef, exception *pExceptPtr)

Definition at line 404 of file DBBase.h.

Enumeration Type Documentation

Data types can be used as parameters when running SQL operations.

Enumerator:
DBT_Null 

DBT_Null unidentified or null data ty pe.

DBT_Number 

DBT_Number a numeric type.

DBT_String 

DBT_String a string type.

DBT_Float 

DBT_Float a double precision numeric type.

DBT_Binary 

DBT_Binary a binary data type.

Definition at line 35 of file DBTypes.h.

Function Documentation

string& HSEPData::BaseWhatMethod ( string &  pMessageRef,
exception *  pExceptionPtr 
)

Definition at line 28 of file DBBase.cpp.

Referenced by HSEPData::DBException::DBException().

+ Here is the caller graph for this function: