![]() |
Workspace 6.21.5
|
Typed derived class of SqlBoundObjectGroup from which all implementations of SqlBoundObjectGroup should extend. Uses CRTP to implement most methods. More...
#include <DataAnalysis/DataStructures/typedsqlboundobjectgroup.h>
Public Types | |
typedef PrimaryKeyType | IdType |
Public Member Functions | |
bool | bindPrimaryKeyField (const DataExecution::TypedObject< PrimaryKeyType > &pkObj, bool autoIncrement=false) |
TypedSqlBoundObjectGroup * | clone () const override |
TypedSqlBoundObjectGroup * | deepCopy () const override |
Derived & | operator= (const Derived &obj) |
TypedSqlBoundObjectGroup & | operator= (const TypedSqlBoundObjectGroup &obj) |
Derived * | shallowCopy () const |
![]() | |
~SqlBoundObjectGroup () override | |
SqlBoundObjectGroup * | clone () const override=0 |
virtual SqlBoundObjectGroup * | deepCopy () const =0 |
void | detach (bool recursive=false) |
QStringList | getAutoIncrementFieldNames () const |
QString | getBoundTableName () const |
QStringList | getCompositePrimaryKeyFieldNames () const |
QStringList | getCompositePrimaryKeyFieldNamesAliased () const |
QString | getFieldName (const DataExecution::DataObject &object) const |
QStringList | getNonRelationFieldAliases () const |
QStringList | getNonRelationFieldNames () const |
DataExecution::DataObject & | getPrimaryKeyField () |
const DataExecution::DataObject & | getPrimaryKeyField () const |
QString | getPrimaryKeyFieldName () const |
QString | getPrimaryKeyFieldNameAliased () const |
SqlBindingRelationMap | getRelationBindings (const QStringList &relationNames=QStringList(), bool recursive=false) const |
QStringList | getRelationFieldNames (bool recursive) const |
QStringList | getSqlValidCompositePrimaryKeyFieldNames () const |
QStringList | getSqlValidFieldList () const |
bool | hasCompositePrimaryKey () const |
bool | isPersistent () const |
bool | isPrimaryKeyField (const DataExecution::DataObject &obj) const |
bool | isRelationField (const QString &fieldName) const |
void | setPersistent (bool b) |
![]() | |
~ObjectGroup () override | |
bool | add (const QString &name, DataObject &obj) |
bool | canSerialize () const override |
ObjectGroup * | clone () const override=0 |
bool | empty () const |
void | ensureGroupHasData () |
void | erase (int index) |
DataObject * | getChild (const QString &name) |
const DataObject * | getChild (const QString &name) const |
DataObject & | getDataObject (int index) |
const DataObject & | getDataObject (int index) const |
int | getIndex (const QString &name) const |
const QString & | getName (int index) const |
virtual QString | getPreferedWidget (const QString &name) const |
bool | hasData () const |
bool | haveName (const QString &name) const |
bool | insert (const QString &name, DataObject &obj, int index=-1) |
bool | load (const QJsonDocument &doc) |
bool | load (const SerializedItem &item) override |
bool | save (QJsonDocument &doc) const |
bool | save (SerializedItem &item) const override |
unsigned | size () const |
![]() | |
virtual | ~Clonable ()=default |
virtual Clonable * | clone () const =0 |
![]() | |
virtual | ~Serialize ()=default |
virtual bool | canSerialize () const =0 |
virtual bool | load (const SerializedItem &item)=0 |
virtual bool | save (SerializedItem &item) const =0 |
Protected Member Functions | |
TypedSqlBoundObjectGroup () | |
TypedSqlBoundObjectGroup (const TypedSqlBoundObjectGroup &other) | |
const SqlBoundObjectClassData & | getClassData () const override |
QSqlQuery | getInsertQuery (const SqlDataModel &model, const QStringList &relations, const QString &foreignKeyName, const QVariant &foreignKeyValue) const override |
QSqlQuery | getUpdateQuery (const SqlDataModel &model, const QStringList &relations, const QString &foreignKeyName, const QVariant &foreignKeyValue) const override |
![]() | |
SqlBoundObjectGroup (const SqlBoundObjectGroup &other) | |
SqlBoundObjectGroup (SqlBoundObjectGroupData *data) | |
bool | bindCompositePrimaryKey (const QList< const DataExecution::DataObject * > &objects) |
bool | bindField (const QString &fieldName, DataExecution::DataObject &object) |
bool | bindRelation (const SqlBindingRelation &relation) |
virtual const SqlBoundObjectClassData & | getClassData () const =0 |
virtual QSqlQuery | getInsertQuery (const SqlDataModel &model, const QStringList &relations, const QString &foreignKeyName=QString(), const QVariant &foreignKeyValue=QVariant()) const =0 |
virtual QSqlQuery | getUpdateQuery (const SqlDataModel &model, const QStringList &relations, const QString &foreignKeyName=QString(), const QVariant &foreignKeyValue=QVariant()) const =0 |
SqlBoundObjectGroup & | operator= (const SqlBoundObjectGroup &) |
bool | operator== (const SqlBoundObjectGroup &rhs) const |
bool | setPrimaryKeyField (const DataExecution::DataObject &obj, bool autoIncrement) |
![]() | |
ObjectGroup () | |
void | clear () |
ObjectGroup & | operator= (const ObjectGroup &rhs) |
bool | operator== (const ObjectGroup &rhs) const |
void | swap (ObjectGroup &rhs) |
Derived | The derived class itself. |
PrimaryKeyType | The type of the primary key data stored in Derived. |
TypedSqlBoundObjectGroup provides a set of utility functions as well as guaranteed type safety between SqlBoundObjectGroup derived classes. It allows the SqlDataModel to make reasonable assumptions about bound objects, most notably the data type of their primary key (and therefore foreign keys of relation types).
The class also provides virtual function implementations for all of the pure-virtual methods of the SqlBoundObjectGroup class, as well as a number of convenience "typed" methods to make interacting with derived classes simpler in the SqlDataModel methods.
typedef PrimaryKeyType IdType |
|
inlineprotected |
Constructs a new TypedSqlBoundObjectGroup (internal constructor only, intended for derived classes), which will create a new explicitly shared data object and provide it to the SqlBoundObjectGroup base class, along with a reference to the static class data associated with the type (e.g. the bound table name, for example).
All derived class constructors will call this constructor in their initialisation list.
|
inlineprotected |
other | The other TypedSqlBoundObjectGroup to copy from. |
|
inline |
pkObj | The data object containing the primary key data. |
autoIncrement | Set to true if this field is set to auto-increment in the database. |
Typed method for binding the primary key object. Note that pkObj is of the same primary key type as this object.
|
inlineoverridevirtual |
Implements SqlBoundObjectGroup.
|
inlineoverridevirtual |
Implements SqlBoundObjectGroup.
|
inlineoverrideprotectedvirtual |
Implements SqlBoundObjectGroup.
|
inlineoverrideprotectedvirtual |
model | The SqlDataModel responsible for the insertion operation. |
relations | A list of relations to follow when generating the insert. |
foreignKeyName | (optional) The name of a foreign key field attached to the table that this object is bound to. Important for inserting objects with bi-directional relations. |
foreignKeyValue | The value to store in the field named foreignKeyName when inserting this object. |
Returns the SQL query required to insert this particular object into a database. Callers should never need to invoke this method directly.
Implements SqlBoundObjectGroup.
|
inlineoverrideprotectedvirtual |
model | The SqlDataModel responsible for the update operation. |
relations | A list of relations to follow when generating the update. |
foreignKeyName | (optional) The name of a foreign key field attached to the table that this object is bound to. Important for updating objects with bi-directional relations. |
foreignKeyValue | The value to store in the field named foreignKeyName when updating this object. |
Implements SqlBoundObjectGroup.
|
inline |
|
inline |
obj | The object to assign to this one. |
|
inline |