![]() |
QxOrm
1.4.2
C++ Object Relational Mapping library
|
qx::QxModelService<T, S> : provides an easy way to connect your model to the QxService module (all queries are executed over network using client/server communication) More...
#include <QxModelService.h>
Public Types | |
typedef qx::QxModel< T >::type_ptr | type_ptr |
typedef qx::QxModel< T > ::type_primary_key | type_primary_key |
typedef qx::QxModel< T > ::type_collection | type_collection |
typedef qx_shared_ptr < type_collection > | type_collection_ptr |
Public Member Functions | |
QxModelService (QObject *parent=0) | |
QxModelService (qx::IxModel *other, QObject *parent) | |
virtual | ~QxModelService () |
virtual long | qxCount (const qx::QxSqlQuery &query=qx::QxSqlQuery(), QSqlDatabase *pDatabase=NULL) |
Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm context) and filtered by a user SQL query. | |
virtual QSqlError | qxCount (long &lCount, const qx::QxSqlQuery &query=qx::QxSqlQuery(), QSqlDatabase *pDatabase=NULL) |
Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm context) and filtered by a user SQL query. | |
virtual QSqlError | qxFetchById (const QVariant &id, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Clear the model and fetch an object (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database. | |
virtual QSqlError | qxFetchAll (const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type T (container registered into QxOrm context) mapped to a table in the database. | |
virtual QSqlError | qxFetchByQuery (const qx::QxSqlQuery &query, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type T (container registered into QxOrm context) mapped to a table in the database and filtered by a user SQL query. | |
virtual QSqlError | qxFetchRow (int row, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Get an item in the model at line row and fetch all its properties mapped to a table in the database, then all views attached to this model are automatically updated. | |
virtual QSqlError | qxInsert (const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Insert all items in the model into database. | |
virtual QSqlError | qxInsertRow (int row, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Insert an item of the model at line row into database. | |
virtual QSqlError | qxUpdate (const qx::QxSqlQuery &query=qx::QxSqlQuery(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Update all items in the model into database. | |
virtual QSqlError | qxUpdateRow (int row, const qx::QxSqlQuery &query=qx::QxSqlQuery(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Update an item of the model at line row into database. | |
virtual QSqlError | qxSave (const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Save all items (insert or update) in the model into database. | |
virtual QSqlError | qxSaveRow (int row, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL) |
Save an item of the model at line row into database. | |
virtual QSqlError | qxDeleteById (const QVariant &id, QSqlDatabase *pDatabase=NULL) |
Delete a line of a table (database) mapped to a C++ object of type T (registered into QxOrm context), if no error occurred then you should remove row from the model. | |
virtual QSqlError | qxDeleteAll (QSqlDatabase *pDatabase=NULL) |
Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context), if no error occurred then you should clear the model. | |
virtual QSqlError | qxDeleteByQuery (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL) |
Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query, if no error occurred then you should refresh the model. | |
virtual QSqlError | qxDeleteRow (int row, QSqlDatabase *pDatabase=NULL) |
Delete in database the item at line row in the model, if no error occurred then you should remove row from the model. | |
virtual QSqlError | qxDestroyById (const QVariant &id, QSqlDatabase *pDatabase=NULL) |
Delete a line of a table (even if a logical delete is defined) mapped to a C++ object of type T (registered into QxOrm context), if no error occurred then you should remove row from the model. | |
virtual QSqlError | qxDestroyAll (QSqlDatabase *pDatabase=NULL) |
Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered into QxOrm context), if no error occurred then you should clear the model. | |
virtual QSqlError | qxDestroyByQuery (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL) |
Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query, if no error occurred then you should refresh the model. | |
virtual QSqlError | qxDestroyRow (int row, QSqlDatabase *pDatabase=NULL) |
Delete in database (even if a logical delete is defined) the item at line row in the model, if no error occurred then you should remove row from the model. | |
virtual QSqlError | qxExecuteQuery (qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL) |
virtual qx_bool | qxExist (const QVariant &id, QSqlDatabase *pDatabase=NULL) |
virtual qx::QxInvalidValueX | qxValidate (const QStringList &groups=QStringList()) |
virtual qx::QxInvalidValueX | qxValidateRow (int row, const QStringList &groups=QStringList()) |
qx::QxModelService<T, S> : provides an easy way to connect your model to the QxService module (all queries are executed over network using client/server communication)
T template parameter is a persistent class registered into QxOrm context S template parameter is a service class generated by QxEntityEditor (or your own service class providing all methods)
Definition at line 58 of file QxModelService.h.
typedef qx::QxModel<T>::type_collection qx::QxModelService< T, S >::type_collection |
Reimplemented from qx::QxModel< T >.
Definition at line 65 of file QxModelService.h.
typedef qx_shared_ptr<type_collection> qx::QxModelService< T, S >::type_collection_ptr |
Definition at line 66 of file QxModelService.h.
typedef qx::QxModel<T>::type_primary_key qx::QxModelService< T, S >::type_primary_key |
Reimplemented from qx::QxModel< T >.
Definition at line 64 of file QxModelService.h.
typedef qx::QxModel<T>::type_ptr qx::QxModelService< T, S >::type_ptr |
Reimplemented from qx::QxModel< T >.
Definition at line 63 of file QxModelService.h.
qx::QxModelService< T, S >::QxModelService | ( | QObject * | parent = 0 | ) | [inline] |
Definition at line 70 of file QxModelService.h.
qx::QxModelService< T, S >::QxModelService | ( | qx::IxModel * | other, |
QObject * | parent | ||
) | [inline] |
Definition at line 71 of file QxModelService.h.
virtual qx::QxModelService< T, S >::~QxModelService | ( | ) | [inline, virtual] |
Definition at line 72 of file QxModelService.h.
virtual long qx::QxModelService< T, S >::qxCount | ( | const qx::QxSqlQuery & | query = qx::QxSqlQuery() , |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm context) and filtered by a user SQL query.
query | Define a user SQL query added to default SQL query builded by QxOrm library (optional parameter) |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 74 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxCount | ( | long & | lCount, |
const qx::QxSqlQuery & | query = qx::QxSqlQuery() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm context) and filtered by a user SQL query.
lCount | Output parameter with the number of lines in the table associated to the SQL query |
query | Define a user SQL query added to default SQL query builded by QxOrm library (optional parameter) |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 81 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDeleteAll | ( | QSqlDatabase * | pDatabase = NULL | ) | [inline, virtual] |
Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context), if no error occurred then you should clear the model.
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 263 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDeleteById | ( | const QVariant & | id, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Delete a line of a table (database) mapped to a C++ object of type T (registered into QxOrm context), if no error occurred then you should remove row from the model.
id | Row id to be deleted from database |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 250 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDeleteByQuery | ( | const qx::QxSqlQuery & | query, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query, if no error occurred then you should refresh the model.
query | Define a user SQL query added to default SQL query builded by QxOrm library |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 271 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDeleteRow | ( | int | row, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Delete in database the item at line row in the model, if no error occurred then you should remove row from the model.
row | Delete in database the item in the model at line row |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 279 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDestroyAll | ( | QSqlDatabase * | pDatabase = NULL | ) | [inline, virtual] |
Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered into QxOrm context), if no error occurred then you should clear the model.
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 303 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDestroyById | ( | const QVariant & | id, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Delete a line of a table (even if a logical delete is defined) mapped to a C++ object of type T (registered into QxOrm context), if no error occurred then you should remove row from the model.
id | Row id to be deleted from database |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 290 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDestroyByQuery | ( | const qx::QxSqlQuery & | query, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query, if no error occurred then you should refresh the model.
query | Define a user SQL query added to default SQL query builded by QxOrm library |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 311 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxDestroyRow | ( | int | row, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Delete in database (even if a logical delete is defined) the item at line row in the model, if no error occurred then you should remove row from the model.
row | Delete in database the item in the model at line row |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 319 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxExecuteQuery | ( | qx::QxSqlQuery & | query, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Reimplemented from qx::QxModel< T >.
Definition at line 330 of file QxModelService.h.
virtual qx_bool qx::QxModelService< T, S >::qxExist | ( | const QVariant & | id, |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Reimplemented from qx::QxModel< T >.
Definition at line 347 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxFetchAll | ( | const QStringList & | relation = QStringList() , |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type T (container registered into QxOrm context) mapped to a table in the database.
relation | List of relationships keys to be fetched (eager fetch instead of default lazy fetch for a relation) : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 109 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxFetchById | ( | const QVariant & | id, |
const QStringList & | relation = QStringList() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Clear the model and fetch an object (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database.
id | Row id to be fetched (retrieve all properties from database) |
relation | List of relationships keys to be fetched (eager fetch instead of default lazy fetch for a relation) : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 89 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxFetchByQuery | ( | const qx::QxSqlQuery & | query, |
const QStringList & | relation = QStringList() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type T (container registered into QxOrm context) mapped to a table in the database and filtered by a user SQL query.
query | Define a user SQL query added to default SQL query builded by QxOrm library |
relation | List of relationships keys to be fetched (eager fetch instead of default lazy fetch for a relation) : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 126 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxFetchRow | ( | int | row, |
const QStringList & | relation = QStringList() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Get an item in the model at line row and fetch all its properties mapped to a table in the database, then all views attached to this model are automatically updated.
row | Get an item in the model at line row |
relation | List of relationships keys to be fetched (eager fetch instead of default lazy fetch for a relation) : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 143 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxInsert | ( | const QStringList & | relation = QStringList() , |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Insert all items in the model into database.
relation | List of relationships keys to be inserted in others tables of database : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 160 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxInsertRow | ( | int | row, |
const QStringList & | relation = QStringList() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Insert an item of the model at line row into database.
row | Insert an item in the model at line row |
relation | List of relationships keys to be inserted in others tables of database : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 176 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxSave | ( | const QStringList & | relation = QStringList() , |
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Save all items (insert or update) in the model into database.
relation | List of relationships keys to be inserted in others tables of database : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 220 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxSaveRow | ( | int | row, |
const QStringList & | relation = QStringList() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Save an item of the model at line row into database.
row | Save an item (insert or update) in the model at line row |
relation | List of relationships keys to be inserted in others tables of database : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 236 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxUpdate | ( | const qx::QxSqlQuery & | query = qx::QxSqlQuery() , |
const QStringList & | relation = QStringList() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Update all items in the model into database.
query | Define a user SQL query added to default SQL query builded by QxOrm library |
relation | List of relationships keys to be inserted in others tables of database : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 190 of file QxModelService.h.
virtual QSqlError qx::QxModelService< T, S >::qxUpdateRow | ( | int | row, |
const qx::QxSqlQuery & | query = qx::QxSqlQuery() , |
||
const QStringList & | relation = QStringList() , |
||
QSqlDatabase * | pDatabase = NULL |
||
) | [inline, virtual] |
Update an item of the model at line row into database.
row | Update an item in the model at line row |
query | Define a user SQL query added to default SQL query builded by QxOrm library |
relation | List of relationships keys to be inserted in others tables of database : use "|" separator to put many relationships keys into this parameter |
pDatabase | Connection to database (you can manage your own connection pool for example, you can also define a transaction, etc.); if NULL, a valid connection for the current thread is provided by qx::QxSqlDatabase singleton class (optional parameter) |
Reimplemented from qx::QxModel< T >.
Definition at line 206 of file QxModelService.h.
virtual qx::QxInvalidValueX qx::QxModelService< T, S >::qxValidate | ( | const QStringList & | groups = QStringList() | ) | [inline, virtual] |
Reimplemented from qx::QxModel< T >.
Definition at line 359 of file QxModelService.h.
virtual qx::QxInvalidValueX qx::QxModelService< T, S >::qxValidateRow | ( | int | row, |
const QStringList & | groups = QStringList() |
||
) | [inline, virtual] |
Reimplemented from qx::QxModel< T >.
Definition at line 369 of file QxModelService.h.