| QxOrm 1.4.2 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
qx::QxSqlDatabase Class Reference
QxDao : QxOrm library database communication used by persistence engine (ORM - Object Relational Mapping)

qx::QxSqlDatabase : define all parameters to connect to database and retrieve a valid connection by thread (this class is a singleton and is thread-safe) More...

`#include <QxSqlDatabase.h>`

Inheritance diagram for qx::QxSqlDatabase:

List of all members.

## Public Types
enum | ph_style { ph_style_question_mark, ph_style_2_point_name, ph_style_at_name }
## Public Member Functions
QString | getDriverName () const
QString | getConnectOptions () const
QString | getDatabaseName () const
QString | getUserName () const
QString | getPassword () const
QString | getHostName () const
int | getPort () const
bool | getTraceSqlQuery () const
bool | getTraceSqlRecord () const
ph_style | getSqlPlaceHolderStyle () const
bool | getSessionThrowable () const
bool | getSessionAutoTransaction () const
bool | getValidatorThrowable () const
bool | getAutoReplaceSqlAliasIntoQuery () const
bool | getVerifyOffsetRelation () const
bool | getAddAutoIncrementIdToUpdateQuery () const
bool | getForceParentIdToAllChildren () const
void | setDriverName (const QString &s)
void | setConnectOptions (const QString &s)
void | setDatabaseName (const QString &s)
void | setUserName (const QString &s)
void | setPassword (const QString &s)
void | setHostName (const QString &s)
void | setPort (int i)
void | setTraceSqlQuery (bool b)
void | setTraceSqlRecord (bool b)
void | setSqlPlaceHolderStyle (ph_style e)
void | setSessionThrowable (bool b)
void | setSessionAutoTransaction (bool b)
void | setValidatorThrowable (bool b)
void | setSqlGenerator (qx::dao::detail::IxSqlGenerator_ptr p)
void | setAutoReplaceSqlAliasIntoQuery (bool b)
void | setVerifyOffsetRelation (bool b)
void | setAddAutoIncrementIdToUpdateQuery (bool b)
void | setForceParentIdToAllChildren (bool b)
qx::dao::detail::IxSqlGenerator * | getSqlGenerator ()
## Static Public Member Functions
static QSqlDatabase | getDatabase ()
static QSqlDatabase | getDatabase (QSqlError &dbError)
static QSqlDatabase | getDatabaseCloned ()
static void | closeAllDatabases ()
static void | clearAllDatabases ()
## Private Member Functions
| QxSqlDatabase ()
virtual | ~QxSqlDatabase ()
QSqlDatabase | getDatabaseByCurrThreadId (QSqlError &dbError)
QSqlDatabase | createDatabase (QSqlError &dbError)
void | displayLastError (const QSqlDatabase &db, const QString &sDesc) const
QString | formatLastError (const QSqlDatabase &db) const
bool | isValid () const
## Private Attributes
QHash< Qt::HANDLE, QString > | m_lstDbByThread
| Collection of databases connexions by thread id.
QMutex | m_oDbMutex
| Mutex => 'QxSqlDatabase' is thread-safe.
QString | m_sDriverName
| Driver name to connect to database.
QString | m_sConnectOptions
| Connect options to database.
QString | m_sDatabaseName
| Database name.
QString | m_sUserName
| Connection's user name.
QString | m_sPassword
| Connection's password.
QString | m_sHostName
| Connection's host name.
int | m_iPort
| Connection's port number.
bool | m_bTraceSqlQuery
| Trace each sql query executed.
bool | m_bTraceSqlRecord
| Trace each sql record.
ph_style | m_ePlaceHolderStyle
| Place holder style to build sql query.
bool | m_bSessionThrowable
| An exception of type qx::dao::sql_error is thrown when a SQL error is appended to qx::QxSession object.
bool | m_bSessionAutoTransaction
| A transaction is automatically beginned when a qx::QxSession object is instantiated.
bool | m_bValidatorThrowable
| An exception of type qx::validator_error is thrown when invalid values are detected inserting or updating an element into database.
qx::dao::detail::IxSqlGenerator_ptr | m_pSqlGenerator
| SQL generator to build SQL query specific for each database.
bool | m_bAutoReplaceSqlAliasIntoQuery
| Replace all sql alias into sql query automatically.
bool | m_bVerifyOffsetRelation
| Only for debug purpose : assert if invalid offset detected fetching a relation.
bool | m_bAddAutoIncrementIdToUpdateQuery
| For Microsoft SqlServer database compatibility : add or not auto-increment id to SQL update query.
bool | m_bForceParentIdToAllChildren
| Force parent id to all children (for 1-n relationship for example)
## Friends
class | QxSingleton< QxSqlDatabase >

## Detailed Description

qx::QxSqlDatabase : define all parameters to connect to database and retrieve a valid connection by thread (this class is a singleton and is thread-safe)

Definition at line 72 of file QxSqlDatabase.h.

## Member Enumeration Documentation

enum qx::QxSqlDatabase::ph_style

Enumerator:

  ph_style_question_mark |
  ph_style_2_point_name |
  ph_style_at_name |

Definition at line 79 of file QxSqlDatabase.h.

## Constructor & Destructor Documentation

qx::QxSqlDatabase::QxSqlDatabase | ( |  | ) | `[inline, private]`

Definition at line 106 of file QxSqlDatabase.h.

virtual qx::QxSqlDatabase::~QxSqlDatabase | ( |  | ) | `[inline, private, virtual]`

Definition at line 107 of file QxSqlDatabase.h.

## Member Function Documentation

static void qx::QxSqlDatabase::clearAllDatabases | ( |  | ) | `[static]`

static void qx::QxSqlDatabase::closeAllDatabases | ( |  | ) | `[static]`

QSqlDatabase qx::QxSqlDatabase::createDatabase | ( | QSqlError & | dbError | ) | `[private]`

void qx::QxSqlDatabase::displayLastError | ( | const QSqlDatabase & | db,
|  | const QString & | sDesc
| ) |  | const`[private]`

QString qx::QxSqlDatabase::formatLastError | ( | const QSqlDatabase & | db | ) | const`[private]`

bool qx::QxSqlDatabase::getAddAutoIncrementIdToUpdateQuery | ( |  | ) | const`[inline]`

Definition at line 126 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getAutoReplaceSqlAliasIntoQuery | ( |  | ) | const`[inline]`

Definition at line 124 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::getConnectOptions | ( |  | ) | const`[inline]`

Definition at line 112 of file QxSqlDatabase.h.

static QSqlDatabase qx::QxSqlDatabase::getDatabase | ( |  | ) | `[static]`

static QSqlDatabase qx::QxSqlDatabase::getDatabase | ( | QSqlError & | dbError | ) | `[static]`

QSqlDatabase qx::QxSqlDatabase::getDatabaseByCurrThreadId | ( | QSqlError & | dbError | ) | `[private]`

static QSqlDatabase qx::QxSqlDatabase::getDatabaseCloned | ( |  | ) | `[static]`

QString qx::QxSqlDatabase::getDatabaseName | ( |  | ) | const`[inline]`

Definition at line 113 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::getDriverName | ( |  | ) | const`[inline]`

Definition at line 111 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getForceParentIdToAllChildren | ( |  | ) | const`[inline]`

Definition at line 127 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::getHostName | ( |  | ) | const`[inline]`

Definition at line 116 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::getPassword | ( |  | ) | const`[inline]`

Definition at line 115 of file QxSqlDatabase.h.

int qx::QxSqlDatabase::getPort | ( |  | ) | const`[inline]`

Definition at line 117 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getSessionAutoTransaction | ( |  | ) | const`[inline]`

Definition at line 122 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getSessionThrowable | ( |  | ) | const`[inline]`

Definition at line 121 of file QxSqlDatabase.h.

qx::dao::detail::IxSqlGenerator* qx::QxSqlDatabase::getSqlGenerator | ( |  | ) |

ph_style qx::QxSqlDatabase::getSqlPlaceHolderStyle | ( |  | ) | const`[inline]`

Definition at line 120 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getTraceSqlQuery | ( |  | ) | const`[inline]`

Definition at line 118 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getTraceSqlRecord | ( |  | ) | const`[inline]`

Definition at line 119 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::getUserName | ( |  | ) | const`[inline]`

Definition at line 114 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getValidatorThrowable | ( |  | ) | const`[inline]`

Definition at line 123 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::getVerifyOffsetRelation | ( |  | ) | const`[inline]`

Definition at line 125 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::isValid | ( |  | ) | const`[inline, private]`

Definition at line 164 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setAddAutoIncrementIdToUpdateQuery | ( | bool | b | ) | `[inline]`

Definition at line 145 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setAutoReplaceSqlAliasIntoQuery | ( | bool | b | ) | `[inline]`

Definition at line 143 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setConnectOptions | ( | const QString & | s | ) | `[inline]`

Definition at line 130 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setDatabaseName | ( | const QString & | s | ) | `[inline]`

Definition at line 131 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setDriverName | ( | const QString & | s | ) | `[inline]`

Definition at line 129 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setForceParentIdToAllChildren | ( | bool | b | ) | `[inline]`

Definition at line 146 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setHostName | ( | const QString & | s | ) | `[inline]`

Definition at line 134 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setPassword | ( | const QString & | s | ) | `[inline]`

Definition at line 133 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setPort | ( | int | i | ) | `[inline]`

Definition at line 135 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setSessionAutoTransaction | ( | bool | b | ) | `[inline]`

Definition at line 140 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setSessionThrowable | ( | bool | b | ) | `[inline]`

Definition at line 139 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setSqlGenerator | ( | qx::dao::detail::IxSqlGenerator_ptr | p | ) | `[inline]`

Definition at line 142 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setSqlPlaceHolderStyle | ( | ph_style | e | ) | `[inline]`

Definition at line 138 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setTraceSqlQuery | ( | bool | b | ) | `[inline]`

Definition at line 136 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setTraceSqlRecord | ( | bool | b | ) | `[inline]`

Definition at line 137 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setUserName | ( | const QString & | s | ) | `[inline]`

Definition at line 132 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setValidatorThrowable | ( | bool | b | ) | `[inline]`

Definition at line 141 of file QxSqlDatabase.h.

void qx::QxSqlDatabase::setVerifyOffsetRelation | ( | bool | b | ) | `[inline]`

Definition at line 144 of file QxSqlDatabase.h.

## Friends And Related Function Documentation

friend class QxSingleton< QxSqlDatabase >`[friend]`

Definition at line 75 of file QxSqlDatabase.h.

## Member Data Documentation

bool qx::QxSqlDatabase::m_bAddAutoIncrementIdToUpdateQuery`[private]`

For Microsoft SqlServer database compatibility : add or not auto-increment id to SQL update query.

Definition at line 101 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bAutoReplaceSqlAliasIntoQuery`[private]`

Replace all sql alias into sql query automatically.

Definition at line 99 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bForceParentIdToAllChildren`[private]`

Force parent id to all children (for 1-n relationship for example)

Definition at line 102 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bSessionAutoTransaction`[private]`

A transaction is automatically beginned when a qx::QxSession object is instantiated.

Definition at line 96 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bSessionThrowable`[private]`

An exception of type qx::dao::sql_error is thrown when a SQL error is appended to qx::QxSession object.

Definition at line 95 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bTraceSqlQuery`[private]`

Trace each sql query executed.

Definition at line 92 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bTraceSqlRecord`[private]`

Trace each sql record.

Definition at line 93 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bValidatorThrowable`[private]`

An exception of type qx::validator_error is thrown when invalid values are detected inserting or updating an element into database.

Definition at line 97 of file QxSqlDatabase.h.

bool qx::QxSqlDatabase::m_bVerifyOffsetRelation`[private]`

Only for debug purpose : assert if invalid offset detected fetching a relation.

Definition at line 100 of file QxSqlDatabase.h.

ph_style qx::QxSqlDatabase::m_ePlaceHolderStyle`[private]`

Place holder style to build sql query.

Definition at line 94 of file QxSqlDatabase.h.

int qx::QxSqlDatabase::m_iPort`[private]`

Connection's port number.

Definition at line 91 of file QxSqlDatabase.h.

QHash<Qt::HANDLE, QString> qx::QxSqlDatabase::m_lstDbByThread`[private]`

Collection of databases connexions by thread id.

Definition at line 83 of file QxSqlDatabase.h.

QMutex qx::QxSqlDatabase::m_oDbMutex`[private]`

Mutex => 'QxSqlDatabase' is thread-safe.

Definition at line 84 of file QxSqlDatabase.h.

qx::dao::detail::IxSqlGenerator_ptr qx::QxSqlDatabase::m_pSqlGenerator`[private]`

SQL generator to build SQL query specific for each database.

Definition at line 98 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::m_sConnectOptions`[private]`

Connect options to database.

Definition at line 86 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::m_sDatabaseName`[private]`

Database name.

Definition at line 87 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::m_sDriverName`[private]`

Driver name to connect to database.

Definition at line 85 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::m_sHostName`[private]`

Connection's host name.

Definition at line 90 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::m_sPassword`[private]`

Connection's password.

Definition at line 89 of file QxSqlDatabase.h.

QString qx::QxSqlDatabase::m_sUserName`[private]`

Connection's user name.

Definition at line 88 of file QxSqlDatabase.h.

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

- D:/Dvlp/_Perso/QxOrm/include/QxDao/QxSqlDatabase.h