QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
qx::QxSqlRelation_ManyToMany< DataType, Owner > Class Template Reference

qx::QxSqlRelation_ManyToMany<DataType, Owner> : manage a relationship many-to-many defined between 2 classes (or between 2 tables in database) More...

#include <QxSqlRelation_ManyToMany.h>

Inheritance diagram for qx::QxSqlRelation_ManyToMany< DataType, Owner >:
qx::QxSqlRelation< DataType, Owner > qx::IxSqlRelation qx::QxPropertyBag

Public Member Functions

 QxSqlRelation_ManyToMany (IxDataMember *p, const QString &sExtraTable, const QString &sForeignKeyOwner, const QString &sForeignKeyDataType)
 
virtual ~QxSqlRelation_ManyToMany ()
 
virtual QString getDescription () const
 
virtual bool getCartesianProduct () const
 
virtual void createTable (QxSqlRelationParams &params) const
 
virtual void lazySelect (QxSqlRelationParams &params) const
 
virtual void lazyFrom (QxSqlRelationParams &params) const
 
virtual void eagerFrom (QxSqlRelationParams &params) const
 
virtual void lazyJoin (QxSqlRelationParams &params) const
 
virtual void lazyWhere (QxSqlRelationParams &params) const
 
virtual void eagerWhere (QxSqlRelationParams &params) const
 
virtual void lazyWhereSoftDelete (QxSqlRelationParams &params) const
 
virtual void lazyFetch_ResolveInput (QxSqlRelationParams &params) const
 
virtual void eagerFetch_ResolveInput (QxSqlRelationParams &params) const
 
virtual void lazyFetch_ResolveOutput (QxSqlRelationParams &params) const
 
virtual void lazyInsert (QxSqlRelationParams &params) const
 
virtual void lazyInsert_Values (QxSqlRelationParams &params) const
 
virtual void lazyUpdate (QxSqlRelationParams &params) const
 
virtual void lazyInsert_ResolveInput (QxSqlRelationParams &params) const
 
virtual void lazyUpdate_ResolveInput (QxSqlRelationParams &params) const
 
virtual QSqlError onBeforeSave (QxSqlRelationParams &params) const
 
virtual QVariant getIdFromQuery (bool bEager, QxSqlRelationParams &params, int iOffset, int iNameIndex) const
 
virtual void updateOffset (bool bEager, QxSqlRelationParams &params) const
 
virtual void eagerSelect (QxSqlRelationParams &params) const
 
virtual void eagerJoin (QxSqlRelationParams &params) const
 
virtual void eagerWhereSoftDelete (QxSqlRelationParams &params) const
 
virtual void * eagerFetch_ResolveOutput (QxSqlRelationParams &params) const
 
virtual QSqlError onAfterSave (QxSqlRelationParams &params) const
 
virtual QString createExtraTable () const
 
- Public Member Functions inherited from qx::QxSqlRelation< DataType, Owner >
 QxSqlRelation (IxDataMember *p)
 
virtual ~QxSqlRelation ()
 
virtual void init ()
 
- Public Member Functions inherited from qx::IxSqlRelation
 IxSqlRelation (IxDataMember *p)
 
virtual ~IxSqlRelation ()=0
 
QxCollection< QString, IxDataMember * > * getLstDataMember () const
 
IxSqlRelationXgetLstRelation () const
 
void setSqlJoinType (qx::dao::sql_join::join_type e)
 
qx::dao::sql_join::join_type getSqlJoinType () const
 
relation_type getRelationType () const
 
IxClassgetClass () const
 
IxClassgetClassOwner () const
 
IxDataMembergetDataMember () const
 
IxDataMemberXgetDataMemberX () const
 
IxDataMembergetDataId () const
 
IxDataMembergetDataIdOwner () const
 
QString getKey () const
 
QString getForeignKey () const
 
QString getForeignKeyOwner () const
 
QString getForeignKeyDataType () const
 
QString getExtraTable () const
 
long getDataCount () const
 
long getRelationCount () const
 
IxDataMembergetDataByKey (const QString &sKey) const
 
IxDataMembernextData (long &lIndex) const
 
IxSqlRelationnextRelation (long &lIndex) const
 
QString table () const
 
QString tableAlias (QxSqlRelationParams &params) const
 
QString tableAliasOwner (QxSqlRelationParams &params) const
 
QString getSqlJoin (qx::dao::sql_join::join_type e=qx::dao::sql_join::no_join) const
 
bool traceSqlQuery () const
 
bool verifyOffset (QxSqlRelationParams &params, bool bId) const QX_USED
 
- Public Member Functions inherited from qx::QxPropertyBag
 QxPropertyBag ()
 
virtual ~QxPropertyBag ()
 
void setPropertyBag (const QString &key, const QVariant &value)
 
QVariant getPropertyBag (const QString &key) const
 
void removePropertyBag (const QString &key)
 
void clearPropertyBag ()
 
long countPropertyBag () const
 
QList< QString > getAllPropertyBagKeys () const
 

Private Types

enum  { is_data_container = QxSqlRelation<DataType, Owner>::is_data_container }
 
typedef QxSqlRelation< DataType, Owner >::type_owner type_owner
 
typedef QxSqlRelation< DataType, Owner >::type_data type_data
 
typedef QxSqlRelation< DataType, Owner >::type_container type_container
 
typedef QxSqlRelation< DataType, Owner >::type_generic_container type_generic_container
 
typedef QxSqlRelation< DataType, Owner >::type_item type_item
 
typedef type_generic_container::type_iterator type_iterator
 
typedef type_item::type_value type_value
 

Private Member Functions

void verifyParameters ()
 
QSqlError deleteFromExtraTable (QxSqlRelationParams &params) const
 
QSqlError insertIntoExtraTable (QxSqlRelationParams &params) const
 

Additional Inherited Members

- Public Types inherited from qx::IxSqlRelation
enum  relation_type {
  no_relation , one_to_one , one_to_many , many_to_one ,
  many_to_many
}
 
- Static Public Member Functions inherited from qx::IxSqlRelation
static void setTraceRelationInit (bool bTrace)
 
- Protected Types inherited from qx::QxSqlRelation< DataType, Owner >
enum  { is_valid = (qx::trait::is_qx_registered<type_data>::value && qx::trait::is_qx_registered<type_owner>::value) }
 
enum  { is_data_pointer = (std::is_pointer<DataType>::value || qx::trait::is_smart_ptr<DataType>::value) }
 
enum  { is_data_container = qx::trait::is_container<type_container>::value }
 
enum  { is_same_data_owner = std::is_same<type_data, type_owner>::value }
 
typedef qx::trait::remove_attr< DataType >::type type_tmp_1
 
typedef qx::trait::remove_smart_ptr< type_tmp_1 >::type type_tmp_2
 
typedef type_tmp_2 type_container
 
typedef qx::trait::generic_container< type_containertype_generic_container
 
typedef type_generic_container::type_item type_item
 
typedef std::conditional< qx::trait::is_container< type_container >::value, typenametype_generic_container::type_value_qx, type_container >::type type_tmp_3
 
typedef QxSqlRelation< DataType, Owner >::type_tmp_3 type_data
 
typedef Owner type_owner
 
- Protected Types inherited from qx::QxPropertyBag
typedef QHash< QString, QVariant > type_hash_prop_bag
 
typedef std::shared_ptr< type_hash_prop_bagtype_hash_prop_bag_ptr
 
- Protected Member Functions inherited from qx::QxSqlRelation< DataType, Owner >
DataType * getDataTypePtr (QxSqlRelationParams &params) const
 
type_ownergetOwner (QxSqlRelationParams &params) const
 
type_datagetData (QxSqlRelationParams &params) const
 
type_containergetContainer (QxSqlRelationParams &params) const
 
type_item createItem () const
 
bool isNullData (QxSqlRelationParams &params) const
 
bool callTriggerBeforeFetch (type_data &t, QxSqlRelationParams &params) const
 
bool callTriggerAfterFetch (type_data &t, QxSqlRelationParams &params) const
 
- Protected Member Functions inherited from qx::IxSqlRelation
QVariant getIdFromQuery_ManyToMany (bool bEager, QxSqlRelationParams &params, int iOffset, int iNameIndex) const
 
QVariant getIdFromQuery_ManyToOne (bool bEager, QxSqlRelationParams &params, int iOffset, int iNameIndex) const
 
QVariant getIdFromQuery_OneToMany (bool bEager, QxSqlRelationParams &params, int iOffset, int iNameIndex) const
 
QVariant getIdFromQuery_OneToOne (bool bEager, QxSqlRelationParams &params, int iOffset, int iNameIndex) const
 
void updateOffset_ManyToMany (bool bEager, QxSqlRelationParams &params) const
 
void updateOffset_ManyToOne (bool bEager, QxSqlRelationParams &params) const
 
void updateOffset_OneToMany (bool bEager, QxSqlRelationParams &params) const
 
void updateOffset_OneToOne (bool bEager, QxSqlRelationParams &params) const
 
void eagerSelect_ManyToMany (QxSqlRelationParams &params) const
 
void eagerSelect_ManyToOne (QxSqlRelationParams &params) const
 
void eagerSelect_OneToMany (QxSqlRelationParams &params) const
 
void eagerSelect_OneToOne (QxSqlRelationParams &params) const
 
void eagerJoin_ManyToMany (QxSqlRelationParams &params) const
 
void eagerJoin_ManyToOne (QxSqlRelationParams &params) const
 
void eagerJoin_OneToMany (QxSqlRelationParams &params) const
 
void eagerJoin_OneToOne (QxSqlRelationParams &params) const
 
void eagerWhereSoftDelete_ManyToMany (QxSqlRelationParams &params) const
 
void eagerWhereSoftDelete_ManyToOne (QxSqlRelationParams &params) const
 
void eagerWhereSoftDelete_OneToMany (QxSqlRelationParams &params) const
 
void eagerWhereSoftDelete_OneToOne (QxSqlRelationParams &params) const
 
void lazySelect_ManyToOne (QxSqlRelationParams &params) const
 
void lazyInsert_ManyToOne (QxSqlRelationParams &params) const
 
void lazyInsert_Values_ManyToOne (QxSqlRelationParams &params) const
 
void lazyUpdate_ManyToOne (QxSqlRelationParams &params) const
 
void createTable_ManyToOne (QxSqlRelationParams &params) const
 
QSqlError deleteFromExtraTable_ManyToMany (QxSqlRelationParams &params) const
 
QString createExtraTable_ManyToMany () const
 
bool addLazyRelation (QxSqlRelationParams &params, IxSqlRelation *pRelation) const
 
bool canInit () const
 
void setIsSameDataOwner (int i)
 
void setClass (IxClass *pClass, IxClass *pClassOwner)
 
void setRelationType (relation_type e)
 
void setForeignKey (const QString &s) const
 
void setForeignKeyOwner (const QString &s) const
 
void setForeignKeyDataType (const QString &s) const
 
void setExtraTable (const QString &s) const
 
- Protected Attributes inherited from qx::QxPropertyBag
type_hash_prop_bag_ptr m_lstPropertyBag
 List of all properties in the bag (meta-data)
 

Detailed Description

template<class DataType, class Owner>
class qx::QxSqlRelation_ManyToMany< DataType, Owner >

qx::QxSqlRelation_ManyToMany<DataType, Owner> : manage a relationship many-to-many defined between 2 classes (or between 2 tables in database)

Definition at line 55 of file QxSqlRelation_ManyToMany.h.

Member Typedef Documentation

◆ type_container

template<class DataType , class Owner >
typedef QxSqlRelation<DataType,Owner>::type_container qx::QxSqlRelation_ManyToMany< DataType, Owner >::type_container
private

Definition at line 62 of file QxSqlRelation_ManyToMany.h.

◆ type_data

template<class DataType , class Owner >
typedef QxSqlRelation<DataType,Owner>::type_data qx::QxSqlRelation_ManyToMany< DataType, Owner >::type_data
private

Definition at line 61 of file QxSqlRelation_ManyToMany.h.

◆ type_generic_container

template<class DataType , class Owner >
typedef QxSqlRelation<DataType,Owner>::type_generic_container qx::QxSqlRelation_ManyToMany< DataType, Owner >::type_generic_container
private

Definition at line 63 of file QxSqlRelation_ManyToMany.h.

◆ type_item

template<class DataType , class Owner >
typedef QxSqlRelation<DataType,Owner>::type_item qx::QxSqlRelation_ManyToMany< DataType, Owner >::type_item
private

Definition at line 64 of file QxSqlRelation_ManyToMany.h.

◆ type_iterator

template<class DataType , class Owner >
typedef type_generic_container::type_iterator qx::QxSqlRelation_ManyToMany< DataType, Owner >::type_iterator
private

Definition at line 65 of file QxSqlRelation_ManyToMany.h.

◆ type_owner

template<class DataType , class Owner >
typedef QxSqlRelation<DataType,Owner>::type_owner qx::QxSqlRelation_ManyToMany< DataType, Owner >::type_owner
private

Definition at line 60 of file QxSqlRelation_ManyToMany.h.

◆ type_value

template<class DataType , class Owner >
typedef type_item::type_value qx::QxSqlRelation_ManyToMany< DataType, Owner >::type_value
private

Definition at line 66 of file QxSqlRelation_ManyToMany.h.

Member Enumeration Documentation

◆ anonymous enum

template<class DataType , class Owner >
anonymous enum
private
Enumerator
is_data_container 

Definition at line 68 of file QxSqlRelation_ManyToMany.h.

Constructor & Destructor Documentation

◆ QxSqlRelation_ManyToMany()

template<class DataType , class Owner >
qx::QxSqlRelation_ManyToMany< DataType, Owner >::QxSqlRelation_ManyToMany ( IxDataMember * p,
const QString & sExtraTable,
const QString & sForeignKeyOwner,
const QString & sForeignKeyDataType )
inline

Definition at line 72 of file QxSqlRelation_ManyToMany.h.

◆ ~QxSqlRelation_ManyToMany()

template<class DataType , class Owner >
virtual qx::QxSqlRelation_ManyToMany< DataType, Owner >::~QxSqlRelation_ManyToMany ( )
inlinevirtual

Definition at line 73 of file QxSqlRelation_ManyToMany.h.

Member Function Documentation

◆ createExtraTable()

template<class DataType , class Owner >
virtual QString qx::QxSqlRelation_ManyToMany< DataType, Owner >::createExtraTable ( ) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 181 of file QxSqlRelation_ManyToMany.h.

◆ createTable()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::createTable ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 77 of file QxSqlRelation_ManyToMany.h.

◆ deleteFromExtraTable()

template<class DataType , class Owner >
QSqlError qx::QxSqlRelation_ManyToMany< DataType, Owner >::deleteFromExtraTable ( QxSqlRelationParams & params) const
inlineprivate

Definition at line 189 of file QxSqlRelation_ManyToMany.h.

◆ eagerFetch_ResolveInput()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::eagerFetch_ResolveInput ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 86 of file QxSqlRelation_ManyToMany.h.

◆ eagerFetch_ResolveOutput()

template<class DataType , class Owner >
virtual void * qx::QxSqlRelation_ManyToMany< DataType, Owner >::eagerFetch_ResolveOutput ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 110 of file QxSqlRelation_ManyToMany.h.

◆ eagerFrom()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::eagerFrom ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 80 of file QxSqlRelation_ManyToMany.h.

◆ eagerJoin()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::eagerJoin ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 104 of file QxSqlRelation_ManyToMany.h.

◆ eagerSelect()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::eagerSelect ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 101 of file QxSqlRelation_ManyToMany.h.

◆ eagerWhere()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::eagerWhere ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 83 of file QxSqlRelation_ManyToMany.h.

◆ eagerWhereSoftDelete()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::eagerWhereSoftDelete ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 107 of file QxSqlRelation_ManyToMany.h.

◆ getCartesianProduct()

template<class DataType , class Owner >
virtual bool qx::QxSqlRelation_ManyToMany< DataType, Owner >::getCartesianProduct ( ) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 76 of file QxSqlRelation_ManyToMany.h.

◆ getDescription()

template<class DataType , class Owner >
virtual QString qx::QxSqlRelation_ManyToMany< DataType, Owner >::getDescription ( ) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 75 of file QxSqlRelation_ManyToMany.h.

◆ getIdFromQuery()

template<class DataType , class Owner >
virtual QVariant qx::QxSqlRelation_ManyToMany< DataType, Owner >::getIdFromQuery ( bool bEager,
QxSqlRelationParams & params,
int iOffset,
int iNameIndex ) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 95 of file QxSqlRelation_ManyToMany.h.

◆ insertIntoExtraTable()

template<class DataType , class Owner >
QSqlError qx::QxSqlRelation_ManyToMany< DataType, Owner >::insertIntoExtraTable ( QxSqlRelationParams & params) const
inlineprivate

Definition at line 192 of file QxSqlRelation_ManyToMany.h.

◆ lazyFetch_ResolveInput()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyFetch_ResolveInput ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 85 of file QxSqlRelation_ManyToMany.h.

◆ lazyFetch_ResolveOutput()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyFetch_ResolveOutput ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 87 of file QxSqlRelation_ManyToMany.h.

◆ lazyFrom()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyFrom ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 79 of file QxSqlRelation_ManyToMany.h.

◆ lazyInsert()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyInsert ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 88 of file QxSqlRelation_ManyToMany.h.

◆ lazyInsert_ResolveInput()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyInsert_ResolveInput ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 91 of file QxSqlRelation_ManyToMany.h.

◆ lazyInsert_Values()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyInsert_Values ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 89 of file QxSqlRelation_ManyToMany.h.

◆ lazyJoin()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyJoin ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 81 of file QxSqlRelation_ManyToMany.h.

◆ lazySelect()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazySelect ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 78 of file QxSqlRelation_ManyToMany.h.

◆ lazyUpdate()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyUpdate ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 90 of file QxSqlRelation_ManyToMany.h.

◆ lazyUpdate_ResolveInput()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyUpdate_ResolveInput ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 92 of file QxSqlRelation_ManyToMany.h.

◆ lazyWhere()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyWhere ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 82 of file QxSqlRelation_ManyToMany.h.

◆ lazyWhereSoftDelete()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::lazyWhereSoftDelete ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 84 of file QxSqlRelation_ManyToMany.h.

◆ onAfterSave()

template<class DataType , class Owner >
virtual QSqlError qx::QxSqlRelation_ManyToMany< DataType, Owner >::onAfterSave ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 167 of file QxSqlRelation_ManyToMany.h.

◆ onBeforeSave()

template<class DataType , class Owner >
virtual QSqlError qx::QxSqlRelation_ManyToMany< DataType, Owner >::onBeforeSave ( QxSqlRelationParams & params) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 93 of file QxSqlRelation_ManyToMany.h.

◆ updateOffset()

template<class DataType , class Owner >
virtual void qx::QxSqlRelation_ManyToMany< DataType, Owner >::updateOffset ( bool bEager,
QxSqlRelationParams & params ) const
inlinevirtual

Implements qx::IxSqlRelation.

Definition at line 98 of file QxSqlRelation_ManyToMany.h.

◆ verifyParameters()

template<class DataType , class Owner >
void qx::QxSqlRelation_ManyToMany< DataType, Owner >::verifyParameters ( )
inlineprivate

Definition at line 186 of file QxSqlRelation_ManyToMany.h.


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