32#ifndef _QX_SQL_DATABASE_H_
33#define _QX_SQL_DATABASE_H_
46#include <QtCore/qhash.h>
47#include <QtCore/qmutex.h>
48#include <QtCore/qthread.h>
49#include <QtCore/quuid.h>
51#include <QtSql/qsqldatabase.h>
52#include <QtSql/qsqlquery.h>
53#include <QtSql/qsqlerror.h>
83 enum ph_style { ph_style_question_mark, ph_style_2_point_name, ph_style_at_name };
89 struct QxSqlDatabaseImpl;
90 std::unique_ptr<QxSqlDatabaseImpl>
m_pImpl;
128 void setDriverName(
const QString & s,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
129 void setConnectOptions(
const QString & s,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
130 void setDatabaseName(
const QString & s,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
131 void setUserName(
const QString & s,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
132 void setPassword(
const QString & s,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
133 void setHostName(
const QString & s,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
134 void setPort(
int i,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
135 void setTraceSqlQuery(
bool b,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
136 void setTraceSqlRecord(
bool b,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
140 void setSessionThrowable(
bool b,
bool bJustForCurrentThread =
false, QSqlDatabase * pJustForThisDatabase = NULL);
Common interface for all SQL generators to build SQL query specific for each database.
#define QX_DLL_EXPORT_QX_SINGLETON_HPP(x)
Concrete class to define a thread-safe singleton of QxOrm library.
qx::QxSingleton<T> : concrete class to define a thread-safe singleton of type T
qx::QxSqlDatabase : define all parameters to connect to database and retrieve a valid connection by t...
QStringList getSqlDelimiterForColumnName() const
void setSqlDelimiterForColumnNameAlias(const QStringList &lst, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
bool getTraceSqlRecord() const
static QSqlDatabase getDatabaseCloned()
bool getSessionThrowable() const
void setTraceSqlOnlySlowQueriesDatabase(int i, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
bool getAddSqlSquareBracketsForColumnName() const
bool getForceParentIdToAllChildren() const
bool getTraceSqlBoundValuesOnError() const
void clearAllSettingsForDatabase(QSqlDatabase *p)
void setSqlDelimiterForColumnName(const QStringList &lst, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setHostName(const QString &s, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
bool getVerifyOffsetRelation() const
void setFctDatabaseOpen(type_fct_db_open fct, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
QString getDriverName() const
int getTraceSqlOnlySlowQueriesDatabase() const
QString getDatabaseName() const
bool getValidatorThrowable() const
void setTraceSqlRecord(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setAddSqlSquareBracketsForTableName(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
static QSqlDatabase getDatabase()
bool getDisplayTimerDetails() const
QStringList getSqlDelimiterForTableName() const
void setSqlDelimiterForTableNameAlias(const QStringList &lst, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setSqlDelimiterForTableName(const QStringList &lst, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
std::unique_ptr< QxSqlDatabaseImpl > m_pImpl
Private implementation idiom.
void setSessionThrowable(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
bool getTraceSqlBoundValues() const
bool setCurrentDatabaseByThread(QSqlDatabase *p)
std::function< void(QSqlDatabase &)> type_fct_db_open
void setFormatSqlQueryBeforeLogging(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
static void clearAllDatabases()
static void closeAllDatabases()
ph_style getSqlPlaceHolderStyle() const
QString getUserName() const
bool getFormatSqlQueryBeforeLogging() const
void setSqlPlaceHolderStyle(ph_style e, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setTraceSqlQuery(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
bool getAutoReplaceSqlAliasIntoQuery() const
void setSqlGenerator(qx::dao::detail::IxSqlGenerator_ptr p, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
bool getAddSqlSquareBracketsForTableName() const
void setUserName(const QString &s, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
QString getConnectOptions() const
int getTraceSqlOnlySlowQueriesTotal() const
void setTraceSqlBoundValues(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setPassword(const QString &s, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
QString getPassword() const
void clearAllSettingsForCurrentThread()
void setAddSqlSquareBracketsForColumnName(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
QStringList getSqlDelimiterForColumnNameAlias() const
void setVerifyOffsetRelation(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setForceParentIdToAllChildren(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setSessionAutoTransaction(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
type_fct_db_open getFctDatabaseOpen() const
void setValidatorThrowable(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
QStringList getSqlDelimiterForTableNameAlias() const
void setAddAutoIncrementIdToUpdateQuery(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setTraceSqlBoundValuesOnError(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
static QSqlDatabase getDatabase(QSqlError &dbError)
bool getSessionAutoTransaction() const
void setDatabaseName(const QString &s, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setConnectOptions(const QString &s, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setPort(int i, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
QString getHostName() const
void setDisplayTimerDetails(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
static QSqlDatabase checkDatabaseByThread()
bool getAddAutoIncrementIdToUpdateQuery() const
qx::dao::detail::IxSqlGenerator * getSqlGenerator()
bool getTraceSqlQuery() const
void setDriverName(const QString &s, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void setAutoReplaceSqlAliasIntoQuery(bool b, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
void clearCurrentDatabaseByThread()
void setTraceSqlOnlySlowQueriesTotal(int i, bool bJustForCurrentThread=false, QSqlDatabase *pJustForThisDatabase=NULL)
qx::dao::detail::IxDao_Helper : helper class to communicate with database
qx::dao::detail::IxSqlGenerator : common interface for all SQL generators to build SQL query specific...
std::shared_ptr< IxSqlGenerator > IxSqlGenerator_ptr
Root namespace for all QxOrm library features.