32#ifndef _IX_DAO_HELPER_H_
33#define _IX_DAO_HELPER_H_
46#include <QtSql/qsqldatabase.h>
47#include <QtSql/qsqlquery.h>
48#include <QtSql/qsqlerror.h>
49#include <QtSql/qsqldriver.h>
50#include <QtSql/qsqlrecord.h>
72QxInvalidValueX
validate(T & t,
const QString & group);
94 timer_cpp_build_instance, timer_cpp_read_instance,
timer_build_sql, timer_db_open, timer_db_transaction };
98 struct IxDao_HelperImpl;
99 std::unique_ptr<IxDao_HelperImpl>
m_pImpl;
154 bool exec(
bool bForceEmptyExec =
false);
170 if (getDataId() && getDataId()->getAutoIncrement() && this->hasFeature(QSqlDriver::LastInsertId))
178 this->addInvalidValues(invalidValues);
179 return (invalidValues.
count() <= 0);
188 void init(QSqlDatabase * pDatabase,
const QString & sContext);
Common interface for a list of IxDataMember class properties registered into QxOrm context (for examp...
Common interface for all SQL generators to build SQL query specific for each database.
Common interface to build SQL queries to communicate with database.
Common interface for all relationships defined between 2 classes (or between 2 tables in database)
QxOrm thread-safe container (keep insertion order + quick access by index + quick access by key)
Define all parameters to connect to database and retrieve a valid connection by thread.
Define a user SQL query added to default SQL query builded by QxOrm library, and used by qx::dao::xxx...
Hierarchy of relationships to build SQL query.
Define a validator error exception (for example, inserting or updating an element into database) and ...
qx::IxDataMember : common interface for all class properties registered into QxOrm context
qx::IxDataMemberX : common interface for a list of IxDataMember class properties registered into QxOr...
qx::IxSqlQueryBuilder : common interface to build SQL queries to communicate with database
qx::QxCollection<Key, Value> : QxOrm thread-safe container (keep insertion order + quick access by in...
qx::QxInvalidValueX : list of invalid values
qx::QxSession : define a session to manage automatically database transactions (using C++ RAII)
qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library,...
qx::QxSqlRelationLinked : hierarchy of relationships to build SQL query
qx::dao::detail::IxDao_Helper : helper class to communicate with database
QSqlError errInvalidRelation()
QVariant getIdFromQuery(int iNameIndex=-1) const
qx::QxSession * getSession() const
void dumpBoundValues() const
const QSqlQuery & query() const
@ timer_cpp_build_hierarchy
bool prepare(QString &sql)
bool isValidPrimaryKey(const U &u)
const QSqlError & error() const
qx::QxSqlQuery & qxQuery()
bool getAddAutoIncrementIdToUpdateQuery() const
QSqlError errFailed(bool bPrepare=false)
void setUseExecBatch(bool b)
QStringList & itemsAsJson()
const QSqlDatabase & database() const
QSqlError updateError(const QString &sError)
void init(QSqlDatabase *pDatabase, const QString &sContext)
QStringList getSqlColumns() const
void addQuery(bool bResolve)
qx::IxDataMember * nextData(long &l) const
bool getCartesianProduct() const
std::unique_ptr< IxDao_HelperImpl > m_pImpl
Private implementation idiom.
qx::QxCollection< QString, QVariantList > & getListExecBatch()
QSqlDatabase & database()
bool exec(bool bForceEmptyExec=false)
const qx::IxSqlQueryBuilder & builder() const
bool getUseExecBatch() const
qx::QxSqlRelationLinked * getSqlRelationLinked() const
bool validateInstance(U &u)
bool updateSqlRelationX(const QStringList &relation)
const qx::QxSqlQuery & qxQuery() const
IxDao_Helper(qx::IxSqlQueryBuilder *pBuilder, const qx::QxSqlQuery *pQuery=NULL)
qx::IxDataMember * getDataId() const
void timerStart(IxDao_Helper::timer_type timer)
qint64 timerElapsed(IxDao_Helper::timer_type timer)
void addInvalidValues(const qx::QxInvalidValueX &lst)
long getDataCount() const
QSqlError updateError(const QSqlError &error)
QString getIgnoreSoftDeleteHash() const
qx::IxSqlQueryBuilder & builder()
qx::IxDataMemberX * getDataMemberX() const
void updateLastInsertId(U &u)
IxSqlGenerator * getSqlGenerator() const
bool hasFeature(QSqlDriver::DriverFeature ft) const
void setSqlColumns(const QStringList &lst)
qx::dao::detail::IxSqlGenerator : common interface for all SQL generators to build SQL query specific...
qx::trait::get_primary_key<T>::type : return primary key type of T, by default primary key is long ty...
qx::trait::is_valid_primary_key<T>(const T & t) : return true if t can be a valid primary key to be i...
bool is_valid_primary_key(const T &t)
Root namespace for all QxOrm library features.
QxInvalidValueX validate(T &t, const QString &group)
qx::dao::detail::IxDao_Timer : scoped timer to measure database elapsed times (using C++ RAII)
IxDao_Helper::timer_type m_eTimerType
Timer type (database or C++ action)
IxDao_Timer(IxDao_Helper *pDaoHelper, IxDao_Helper::timer_type timer)
IxDao_Helper * m_pDaoHelper
Pointer to dao helper class.