![]() |
QxOrm
1.4.3
C++ Object Relational Mapping library
|
qx::IxSqlQueryBuilder : common interface to build SQL queries to communicate with database More...
#include <IxSqlQueryBuilder.h>
Public Types | |
typedef QPair< QString, QString > | type_id |
typedef QHash< type_id, void * > | type_ptr_by_id |
typedef qx_shared_ptr < type_ptr_by_id > | type_ptr_by_id_ptr |
typedef QList< type_ptr_by_id_ptr > | type_lst_ptr_by_id |
typedef qx_shared_ptr < type_lst_ptr_by_id > | type_lst_ptr_by_id_ptr |
typedef QxCollection< QString, IxDataMember * > | type_lst_data_member |
typedef qx_shared_ptr < type_lst_data_member > | type_lst_data_member_ptr |
Public Member Functions | |
IxSqlQueryBuilder () | |
virtual | ~IxSqlQueryBuilder ()=0 |
IxDataMemberX * | getDataMemberX () const |
QxCollection< QString, IxDataMember * > * | getLstDataMember () const |
IxSqlRelationX * | getLstRelation () const |
qx::dao::detail::IxDao_Helper * | getDaoHelper () const |
void | setDaoHelper (qx::dao::detail::IxDao_Helper *p) |
void | setHashRelation (const QString &s) |
void | setCartesianProduct (bool b) |
QString | getSqlQuery () const |
QString | getHashRelation () const |
QString | table () const |
QxSoftDelete | getSoftDelete () const |
bool | getCartesianProduct () const |
long | getDataCount () const |
long | getRelationCount () const |
IxDataMember * | getDataId () const |
IxDataMember * | nextData (long &l) const |
IxSqlRelation * | nextRelation (long &l) const |
void | initIdX (long lAllRelationCount) |
bool | insertIdX (long lIndex, const QVariant &idOwner, const QVariant &idData, void *ptr) |
void * | existIdX (long lIndex, const QVariant &idOwner, const QVariant &idData) |
void | setSqlQuery (const QString &sql, const QString &key=QString()) |
void | addSqlQueryAlias (const QString &sql, const QString &sqlAlias) |
bool | getAddAutoIncrementIdToUpdateQuery () const |
void | replaceSqlQueryAlias (QString &sql) const |
void | displaySqlQuery (int time_ms=-1) const |
virtual void | init () |
virtual void | clone (const IxSqlQueryBuilder &other) |
virtual IxSqlQueryBuilder & | buildSql (const QStringList &columns=QStringList(), QxSqlRelationLinked *pRelationX=NULL)=0 |
Static Public Member Functions | |
static QString | addSqlCondition (const QString &sql) |
static void | sql_CreateTable (QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_DeleteById (QString &sql, IxSqlQueryBuilder &builder, bool bSoftDelete) |
static void | sql_Exist (QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_FetchAll (QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_FetchAll (QString &sql, IxSqlQueryBuilder &builder, const QStringList &columns) |
static void | sql_FetchAll_WithRelation (qx::QxSqlRelationLinked *pRelationX, QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_FetchById (QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_FetchById (QString &sql, IxSqlQueryBuilder &builder, const QStringList &columns) |
static void | sql_FetchById_WithRelation (qx::QxSqlRelationLinked *pRelationX, QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_Insert (QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_Update (QString &sql, IxSqlQueryBuilder &builder) |
static void | sql_Update (QString &sql, IxSqlQueryBuilder &builder, const QStringList &columns) |
static void | resolveOutput_FetchAll (void *t, QSqlQuery &query, IxSqlQueryBuilder &builder) |
static void | resolveOutput_FetchAll (void *t, QSqlQuery &query, IxSqlQueryBuilder &builder, const QStringList &columns) |
static void | resolveOutput_FetchAll_WithRelation (qx::QxSqlRelationLinked *pRelationX, void *t, QSqlQuery &query, IxSqlQueryBuilder &builder) |
static void | resolveInput_Insert (void *t, QSqlQuery &query, IxSqlQueryBuilder &builder) |
static void | resolveInput_Update (void *t, QSqlQuery &query, IxSqlQueryBuilder &builder) |
static void | resolveInput_Update (void *t, QSqlQuery &query, IxSqlQueryBuilder &builder, const QStringList &columns) |
Protected Member Functions | |
bool | verifyColumns (const QStringList &columns) const BOOST_USED |
IxDataMember * | isValid_DataMember (long lIndex) const |
IxDataMember * | isValid_SqlRelation (long lIndex) const |
Protected Attributes | |
type_lst_data_member_ptr | m_lstDataMemberPtr |
Collection of 'IxDataMember' to build sql query. | |
qx_shared_ptr< IxSqlRelationX > | m_lstSqlRelationPtr |
Collection of 'IxSqlRelation' to build sql query. | |
IxDataMember * | m_pDataMemberId |
Data member id for sql query. | |
QString | m_sSqlQuery |
Current sql query. | |
QString | m_sTableName |
Sql table name of current object. | |
QString | m_sHashRelation |
Optimization : hash to retrieve sql query with relation. | |
bool | m_bCartesianProduct |
Recordset can return cartesian product => same id in multiple records. | |
type_lst_ptr_by_id_ptr | m_pIdX |
Collection of id (and pointer associated) to avoid multiple fetch on same id (cartesian product) | |
QxSoftDelete | m_oSoftDelete |
Soft delete (or logical delete) behavior. | |
QHash< QString, QString > | m_lstSqlQueryAlias |
List of sql alias to replace into sql query. | |
qx::dao::detail::IxDao_Helper * | m_pDaoHelper |
Pointer to the dao helper class associated to the builder. | |
IxDataMemberX * | m_pDataMemberX |
QxDataMemberX<type_sql> singleton reference. | |
bool | m_bInitDone |
Class initialisation finished. | |
Static Protected Attributes | |
static QHash< QString, QString > | m_lstSqlQuery |
Store here all SQL queries generated by child classes. | |
static QHash< QString, QHash < QString, QString > > | m_lstSqlAlias |
Store here all SQL aliases generated by child classes. |
qx::IxSqlQueryBuilder : common interface to build SQL queries to communicate with database
Definition at line 68 of file IxSqlQueryBuilder.h.
typedef QPair<QString, QString> qx::IxSqlQueryBuilder::type_id |
Definition at line 73 of file IxSqlQueryBuilder.h.
typedef QxCollection<QString, IxDataMember *> qx::IxSqlQueryBuilder::type_lst_data_member |
Definition at line 78 of file IxSqlQueryBuilder.h.
typedef qx_shared_ptr<type_lst_data_member> qx::IxSqlQueryBuilder::type_lst_data_member_ptr |
Definition at line 79 of file IxSqlQueryBuilder.h.
typedef QList<type_ptr_by_id_ptr> qx::IxSqlQueryBuilder::type_lst_ptr_by_id |
Definition at line 76 of file IxSqlQueryBuilder.h.
typedef qx_shared_ptr<type_lst_ptr_by_id> qx::IxSqlQueryBuilder::type_lst_ptr_by_id_ptr |
Definition at line 77 of file IxSqlQueryBuilder.h.
typedef QHash<type_id, void *> qx::IxSqlQueryBuilder::type_ptr_by_id |
Definition at line 74 of file IxSqlQueryBuilder.h.
typedef qx_shared_ptr<type_ptr_by_id> qx::IxSqlQueryBuilder::type_ptr_by_id_ptr |
Definition at line 75 of file IxSqlQueryBuilder.h.
qx::IxSqlQueryBuilder::IxSqlQueryBuilder | ( | ) | [inline] |
Definition at line 102 of file IxSqlQueryBuilder.h.
virtual qx::IxSqlQueryBuilder::~IxSqlQueryBuilder | ( | ) | [pure virtual] |
static QString qx::IxSqlQueryBuilder::addSqlCondition | ( | const QString & | sql | ) | [inline, static] |
Definition at line 137 of file IxSqlQueryBuilder.h.
void qx::IxSqlQueryBuilder::addSqlQueryAlias | ( | const QString & | sql, |
const QString & | sqlAlias | ||
) |
virtual IxSqlQueryBuilder& qx::IxSqlQueryBuilder::buildSql | ( | const QStringList & | columns = QStringList() , |
QxSqlRelationLinked * | pRelationX = NULL |
||
) | [pure virtual] |
Implemented in qx::QxSqlQueryBuilder_FetchById_WithRelation< T >, qx::QxSqlQueryBuilder_FetchAll_WithRelation< T >, qx::QxSqlQueryBuilder_CreateTable< T >, qx::QxSqlQueryBuilder_SoftDeleteById< T >, qx::QxSqlQueryBuilder_DeleteById< T >, qx::QxSqlQueryBuilder_SoftDeleteAll< T >, qx::QxSqlQueryBuilder_DeleteAll< T >, qx::QxSqlQueryBuilder_Update< T >, qx::QxSqlQueryBuilder_Insert< T >, qx::QxSqlQueryBuilder_FetchById< T >, qx::QxSqlQueryBuilder_FetchAll< T >, qx::QxSqlQueryBuilder_Exist< T >, and qx::QxSqlQueryBuilder_Count< T >.
virtual void qx::IxSqlQueryBuilder::clone | ( | const IxSqlQueryBuilder & | other | ) | [virtual] |
void qx::IxSqlQueryBuilder::displaySqlQuery | ( | int | time_ms = -1 | ) | const |
void* qx::IxSqlQueryBuilder::existIdX | ( | long | lIndex, |
const QVariant & | idOwner, | ||
const QVariant & | idData | ||
) |
bool qx::IxSqlQueryBuilder::getAddAutoIncrementIdToUpdateQuery | ( | ) | const |
bool qx::IxSqlQueryBuilder::getCartesianProduct | ( | ) | const [inline] |
Definition at line 117 of file IxSqlQueryBuilder.h.
qx::dao::detail::IxDao_Helper* qx::IxSqlQueryBuilder::getDaoHelper | ( | ) | const [inline] |
Definition at line 108 of file IxSqlQueryBuilder.h.
long qx::IxSqlQueryBuilder::getDataCount | ( | ) | const [inline] |
Definition at line 118 of file IxSqlQueryBuilder.h.
IxDataMember* qx::IxSqlQueryBuilder::getDataId | ( | ) | const [inline] |
Definition at line 120 of file IxSqlQueryBuilder.h.
IxDataMemberX* qx::IxSqlQueryBuilder::getDataMemberX | ( | ) | const [inline] |
Definition at line 105 of file IxSqlQueryBuilder.h.
QString qx::IxSqlQueryBuilder::getHashRelation | ( | ) | const [inline] |
Definition at line 114 of file IxSqlQueryBuilder.h.
QxCollection<QString, IxDataMember *>* qx::IxSqlQueryBuilder::getLstDataMember | ( | ) | const [inline] |
Definition at line 106 of file IxSqlQueryBuilder.h.
IxSqlRelationX* qx::IxSqlQueryBuilder::getLstRelation | ( | ) | const [inline] |
Definition at line 107 of file IxSqlQueryBuilder.h.
long qx::IxSqlQueryBuilder::getRelationCount | ( | ) | const [inline] |
Definition at line 119 of file IxSqlQueryBuilder.h.
QxSoftDelete qx::IxSqlQueryBuilder::getSoftDelete | ( | ) | const [inline] |
Definition at line 116 of file IxSqlQueryBuilder.h.
QString qx::IxSqlQueryBuilder::getSqlQuery | ( | ) | const [inline] |
Definition at line 113 of file IxSqlQueryBuilder.h.
virtual void qx::IxSqlQueryBuilder::init | ( | ) | [virtual] |
Reimplemented in qx::QxSqlQueryBuilder< T >.
void qx::IxSqlQueryBuilder::initIdX | ( | long | lAllRelationCount | ) |
bool qx::IxSqlQueryBuilder::insertIdX | ( | long | lIndex, |
const QVariant & | idOwner, | ||
const QVariant & | idData, | ||
void * | ptr | ||
) |
IxDataMember* qx::IxSqlQueryBuilder::isValid_DataMember | ( | long | lIndex | ) | const [protected] |
IxDataMember* qx::IxSqlQueryBuilder::isValid_SqlRelation | ( | long | lIndex | ) | const [protected] |
IxDataMember* qx::IxSqlQueryBuilder::nextData | ( | long & | l | ) | const [inline] |
Definition at line 121 of file IxSqlQueryBuilder.h.
IxSqlRelation* qx::IxSqlQueryBuilder::nextRelation | ( | long & | l | ) | const [inline] |
Definition at line 122 of file IxSqlQueryBuilder.h.
void qx::IxSqlQueryBuilder::replaceSqlQueryAlias | ( | QString & | sql | ) | const |
static void qx::IxSqlQueryBuilder::resolveInput_Insert | ( | void * | t, |
QSqlQuery & | query, | ||
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::resolveInput_Update | ( | void * | t, |
QSqlQuery & | query, | ||
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::resolveInput_Update | ( | void * | t, |
QSqlQuery & | query, | ||
IxSqlQueryBuilder & | builder, | ||
const QStringList & | columns | ||
) | [static] |
static void qx::IxSqlQueryBuilder::resolveOutput_FetchAll | ( | void * | t, |
QSqlQuery & | query, | ||
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::resolveOutput_FetchAll | ( | void * | t, |
QSqlQuery & | query, | ||
IxSqlQueryBuilder & | builder, | ||
const QStringList & | columns | ||
) | [static] |
static void qx::IxSqlQueryBuilder::resolveOutput_FetchAll_WithRelation | ( | qx::QxSqlRelationLinked * | pRelationX, |
void * | t, | ||
QSqlQuery & | query, | ||
IxSqlQueryBuilder & | builder | ||
) | [static] |
void qx::IxSqlQueryBuilder::setCartesianProduct | ( | bool | b | ) | [inline] |
Definition at line 112 of file IxSqlQueryBuilder.h.
void qx::IxSqlQueryBuilder::setDaoHelper | ( | qx::dao::detail::IxDao_Helper * | p | ) | [inline] |
Definition at line 109 of file IxSqlQueryBuilder.h.
void qx::IxSqlQueryBuilder::setHashRelation | ( | const QString & | s | ) | [inline] |
Definition at line 111 of file IxSqlQueryBuilder.h.
void qx::IxSqlQueryBuilder::setSqlQuery | ( | const QString & | sql, |
const QString & | key = QString() |
||
) |
static void qx::IxSqlQueryBuilder::sql_CreateTable | ( | QString & | sql, |
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_DeleteById | ( | QString & | sql, |
IxSqlQueryBuilder & | builder, | ||
bool | bSoftDelete | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_Exist | ( | QString & | sql, |
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_FetchAll | ( | QString & | sql, |
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_FetchAll | ( | QString & | sql, |
IxSqlQueryBuilder & | builder, | ||
const QStringList & | columns | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_FetchAll_WithRelation | ( | qx::QxSqlRelationLinked * | pRelationX, |
QString & | sql, | ||
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_FetchById | ( | QString & | sql, |
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_FetchById | ( | QString & | sql, |
IxSqlQueryBuilder & | builder, | ||
const QStringList & | columns | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_FetchById_WithRelation | ( | qx::QxSqlRelationLinked * | pRelationX, |
QString & | sql, | ||
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_Insert | ( | QString & | sql, |
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_Update | ( | QString & | sql, |
IxSqlQueryBuilder & | builder | ||
) | [static] |
static void qx::IxSqlQueryBuilder::sql_Update | ( | QString & | sql, |
IxSqlQueryBuilder & | builder, | ||
const QStringList & | columns | ||
) | [static] |
QString qx::IxSqlQueryBuilder::table | ( | ) | const [inline] |
Definition at line 115 of file IxSqlQueryBuilder.h.
bool qx::IxSqlQueryBuilder::verifyColumns | ( | const QStringList & | columns | ) | const [protected] |
bool qx::IxSqlQueryBuilder::m_bCartesianProduct [protected] |
Recordset can return cartesian product => same id in multiple records.
Definition at line 89 of file IxSqlQueryBuilder.h.
bool qx::IxSqlQueryBuilder::m_bInitDone [protected] |
Class initialisation finished.
Definition at line 95 of file IxSqlQueryBuilder.h.
Collection of 'IxDataMember' to build sql query.
Definition at line 83 of file IxSqlQueryBuilder.h.
QHash<QString, QHash<QString, QString> > qx::IxSqlQueryBuilder::m_lstSqlAlias [static, protected] |
Store here all SQL aliases generated by child classes.
Definition at line 98 of file IxSqlQueryBuilder.h.
QHash<QString, QString> qx::IxSqlQueryBuilder::m_lstSqlQuery [static, protected] |
Store here all SQL queries generated by child classes.
Definition at line 97 of file IxSqlQueryBuilder.h.
QHash<QString, QString> qx::IxSqlQueryBuilder::m_lstSqlQueryAlias [protected] |
List of sql alias to replace into sql query.
Definition at line 92 of file IxSqlQueryBuilder.h.
qx_shared_ptr<IxSqlRelationX> qx::IxSqlQueryBuilder::m_lstSqlRelationPtr [protected] |
Collection of 'IxSqlRelation' to build sql query.
Definition at line 84 of file IxSqlQueryBuilder.h.
QxSoftDelete qx::IxSqlQueryBuilder::m_oSoftDelete [protected] |
Soft delete (or logical delete) behavior.
Definition at line 91 of file IxSqlQueryBuilder.h.
Pointer to the dao helper class associated to the builder.
Definition at line 93 of file IxSqlQueryBuilder.h.
IxDataMember* qx::IxSqlQueryBuilder::m_pDataMemberId [protected] |
Data member id for sql query.
Definition at line 85 of file IxSqlQueryBuilder.h.
IxDataMemberX* qx::IxSqlQueryBuilder::m_pDataMemberX [protected] |
QxDataMemberX<type_sql> singleton reference.
Definition at line 94 of file IxSqlQueryBuilder.h.
type_lst_ptr_by_id_ptr qx::IxSqlQueryBuilder::m_pIdX [protected] |
Collection of id (and pointer associated) to avoid multiple fetch on same id (cartesian product)
Definition at line 90 of file IxSqlQueryBuilder.h.
QString qx::IxSqlQueryBuilder::m_sHashRelation [protected] |
Optimization : hash to retrieve sql query with relation.
Definition at line 88 of file IxSqlQueryBuilder.h.
QString qx::IxSqlQueryBuilder::m_sSqlQuery [protected] |
Current sql query.
Definition at line 86 of file IxSqlQueryBuilder.h.
QString qx::IxSqlQueryBuilder::m_sTableName [protected] |
Sql table name of current object.
Definition at line 87 of file IxSqlQueryBuilder.h.