| QxOrm 1.2.1 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

Namespaces | Functions
QxDao.h File Reference
QxDao : QxOrm library database communication used by persistence engine (ORM - Object Relational Mapping)

Provide template functions to map C++ class registered into QxOrm context with table database (ORM - Object Relational Mapping) More...

`#include <QtSql/qsqldatabase.h>`
`#include <QtSql/qsqlquery.h>`
`#include <QtSql/qsqlrecord.h>`
`#include <QtSql/qsqlfield.h>`
`#include <QtSql/qsqlerror.h>`
`#include <QtSql/qsqldriver.h>`
`#include <QxCommon/QxBool.h>`
`#include <QxDao/QxSoftDelete.h>`
`#include <QxDao/QxDaoPointer.h>`
`#include <QxDao/QxSqlQuery.h>`

Go to the source code of this file.

## Namespaces
namespace | qx

| Root namespace for all QxOrm library features.
namespace | qx::dao

| Database communication used by persistence engine (ORM - Object Relational Mapping)
namespace | qx::dao::detail

| Internal helper tools for qx::dao namespace.
## Functions
template<class T >
long | qx::dao::count (QSqlDatabase *pDatabase)
| Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm context)
template<class T >
long | qx::dao::count (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_id (T &t, QSqlDatabase *pDatabase)
| Fetch an object t (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_all (T &t, QSqlDatabase *pDatabase)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_query (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| 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.
template<class T >
QSqlError | qx::dao::insert (T &t, QSqlDatabase *pDatabase)
| Insert an element or a list of elements into database.
template<class T >
QSqlError | qx::dao::update (T &t, QSqlDatabase *pDatabase)
| Update an element or a list of elements into database.
template<class T >
QSqlError | qx::dao::update_by_query (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| Update an element or a list of elements into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::save (T &t, QSqlDatabase *pDatabase)
| Insert (if no exist) or update (if already exist) an element or a list of elements into database.
template<class T >
QSqlError | qx::dao::delete_by_id (T &t, QSqlDatabase *pDatabase)
| Delete a line (or list of lines) of a table (database) mapped to a C++ object of type T (registered into QxOrm context)
template<class T >
QSqlError | qx::dao::destroy_by_id (T &t, QSqlDatabase *pDatabase)
| Destroy a line (or list of lines) of a table (database) mapped to a C++ object of type T (registered into QxOrm context), even if a soft delete behavior is defined for class T.
template<class T >
QSqlError | qx::dao::delete_all (QSqlDatabase *pDatabase)
| Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context)
template<class T >
QSqlError | qx::dao::destroy_all (QSqlDatabase *pDatabase)
| Destroy all lines of a table (database) mapped to a C++ class T (registered into QxOrm context), even if a soft delete behavior is defined for class T.
template<class T >
QSqlError | qx::dao::delete_by_query (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase)
| Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query.
template<class T >
QSqlError | qx::dao::destroy_by_query (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase)
| Destroy all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query, even if a soft delete behavior is defined for class T.
template<class T >
QSqlError | qx::dao::create_table (QSqlDatabase *pDatabase)
| Create a table into database (with all columns) mapped to a C++ class T (registered into QxOrm context)
template<class T >
qx_bool | qx::dao::exist (T &t, QSqlDatabase *pDatabase)
| Search if an element (or list of elements) already exists into database.
template<class T >
QSqlError | qx::dao::fetch_by_id_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase)
| Fetch an object t (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_by_id_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase)
| Fetch an object t (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_by_id_with_all_relation (T &t, QSqlDatabase *pDatabase)
| Fetch an object t (retrieve all its properties and relationships) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_all_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase)
| 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.
template<class T >
QSqlError | qx::dao::fetch_all_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase)
| 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.
template<class T >
QSqlError | qx::dao::fetch_all_with_all_relation (T &t, QSqlDatabase *pDatabase)
| Fetch a list of objects (retrieve all elements and properties + all relationships associated) of type T (container registered into QxOrm context) mapped to a table in the database.
template<class T >
QSqlError | qx::dao::fetch_by_query_with_relation (const QString &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_query_with_relation (const QStringList &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_query_with_all_relation (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| Fetch a list of objects (retrieve all elements and properties + all relationships associated) of type T (container registered into QxOrm context) mapped to a table in the database and filtered by a user SQL query.
template<class T >
QSqlError | qx::dao::insert_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase)
| Insert an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::insert_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase)
| Insert an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::insert_with_all_relation (T &t, QSqlDatabase *pDatabase)
| Insert an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
QSqlError | qx::dao::update_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase)
| Update an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::update_by_query_with_relation (const QString &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| Update an element and its relationships (or a list of elements + relationships) into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::update_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase)
| Update an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::update_by_query_with_relation (const QStringList &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| Update an element and its relationships (or a list of elements + relationships) into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::update_with_all_relation (T &t, QSqlDatabase *pDatabase)
| Update an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
QSqlError | qx::dao::update_by_query_with_all_relation (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase)
| Update an element and all its relationships (or a list of elements + all relationships) into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::save_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase)
| Insert (if no exist) or update (if already exist) an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::save_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase)
| Insert (if no exist) or update (if already exist) an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::save_with_all_relation (T &t, QSqlDatabase *pDatabase)
| Insert (if no exist) or update (if already exist) an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
long | qx::dao::count ()
| Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm context)
template<class T >
long | qx::dao::count (const qx::QxSqlQuery &query)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_id (T &t)
| Fetch an object t (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_all (T &t)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_query (const qx::QxSqlQuery &query, T &t)
| 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.
template<class T >
QSqlError | qx::dao::insert (T &t)
| Insert an element or a list of elements into database.
template<class T >
QSqlError | qx::dao::update (T &t)
| Update an element or a list of elements into database.
template<class T >
QSqlError | qx::dao::update_by_query (const qx::QxSqlQuery &query, T &t)
| Update an element or a list of elements into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::save (T &t)
| Insert (if no exist) or update (if already exist) an element or a list of elements into database.
template<class T >
QSqlError | qx::dao::delete_by_id (T &t)
| Delete a line (or list of lines) of a table (database) mapped to a C++ object of type T (registered into QxOrm context)
template<class T >
QSqlError | qx::dao::destroy_by_id (T &t)
| Destroy a line (or list of lines) of a table (database) mapped to a C++ object of type T (registered into QxOrm context), even if a soft delete behavior is defined for class T.
template<class T >
QSqlError | qx::dao::delete_all ()
| Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context)
template<class T >
QSqlError | qx::dao::destroy_all ()
| Destroy all lines of a table (database) mapped to a C++ class T (registered into QxOrm context), even if a soft delete behavior is defined for class T.
template<class T >
QSqlError | qx::dao::delete_by_query (const qx::QxSqlQuery &query)
| Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query.
template<class T >
QSqlError | qx::dao::destroy_by_query (const qx::QxSqlQuery &query)
| Destroy all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and filtered by a user SQL query, even if a soft delete behavior is defined for class T.
template<class T >
QSqlError | qx::dao::create_table ()
| Create a table into database (with all columns) mapped to a C++ class T (registered into QxOrm context)
template<class T >
qx_bool | qx::dao::exist (T &t)
| Search if an element (or list of elements) already exists into database.
template<class T >
QSqlError | qx::dao::fetch_by_id (T &t, QSqlDatabase *pDatabase, const QStringList &columns)
| Fetch an object t (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_all (T &t, QSqlDatabase *pDatabase, const QStringList &columns)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_query (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase, const QStringList &columns)
| 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.
template<class T >
QSqlError | qx::dao::update (T &t, QSqlDatabase *pDatabase, const QStringList &columns)
| Update an element or a list of elements into database.
template<class T >
QSqlError | qx::dao::update_by_query (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase, const QStringList &columns)
| Update an element or a list of elements into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::update_optimized (qx::dao::ptr< T > &ptr)
| Update only modified fields/properties of an element or a list of elements into database (using is dirty pattern and qx::dao::ptr<T> smart-pointer)
template<class T >
QSqlError | qx::dao::update_optimized_by_query (const qx::QxSqlQuery &query, qx::dao::ptr< T > &ptr)
| Update only modified fields/properties of an element or a list of elements into database (using is dirty pattern and qx::dao::ptr<T> smart-pointer), adding a user SQL query to the default SQL query builded by QxOrm library.
template<class T >
QSqlError | qx::dao::update_optimized (qx::dao::ptr< T > &ptr, QSqlDatabase *pDatabase)
| Update only modified fields/properties of an element or a list of elements into database (using is dirty pattern and qx::dao::ptr<T> smart-pointer)
template<class T >
QSqlError | qx::dao::update_optimized_by_query (const qx::QxSqlQuery &query, qx::dao::ptr< T > &ptr, QSqlDatabase *pDatabase)
| Update only modified fields/properties of an element or a list of elements into database (using is dirty pattern and qx::dao::ptr<T> smart-pointer), adding a user SQL query to the default SQL query builded by QxOrm library.
template<class T >
QSqlError | qx::dao::fetch_by_id_with_relation (const QString &relation, T &t)
| Fetch an object t (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_by_id_with_relation (const QStringList &relation, T &t)
| Fetch an object t (retrieve all its properties) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_by_id_with_all_relation (T &t)
| Fetch an object t (retrieve all its properties and relationships) of type T (registered into QxOrm context) mapped to a table in the database (t must have a valid id before to be fetched without error)
template<class T >
QSqlError | qx::dao::fetch_all_with_relation (const QString &relation, T &t)
| 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.
template<class T >
QSqlError | qx::dao::fetch_all_with_relation (const QStringList &relation, T &t)
| 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.
template<class T >
QSqlError | qx::dao::fetch_all_with_all_relation (T &t)
| Fetch a list of objects (retrieve all elements and properties + all relationships associated) of type T (container registered into QxOrm context) mapped to a table in the database.
template<class T >
QSqlError | qx::dao::fetch_by_query_with_relation (const QString &relation, const qx::QxSqlQuery &query, T &t)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_query_with_relation (const QStringList &relation, const qx::QxSqlQuery &query, T &t)
| 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.
template<class T >
QSqlError | qx::dao::fetch_by_query_with_all_relation (const qx::QxSqlQuery &query, T &t)
| Fetch a list of objects (retrieve all elements and properties + all relationships associated) of type T (container registered into QxOrm context) mapped to a table in the database and filtered by a user SQL query.
template<class T >
QSqlError | qx::dao::insert_with_relation (const QString &relation, T &t)
| Insert an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::insert_with_relation (const QStringList &relation, T &t)
| Insert an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::insert_with_all_relation (T &t)
| Insert an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
QSqlError | qx::dao::update_with_relation (const QString &relation, T &t)
| Update an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::update_by_query_with_relation (const QString &relation, const qx::QxSqlQuery &query, T &t)
| Update an element and its relationships (or a list of elements + relationships) into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::update_with_relation (const QStringList &relation, T &t)
| Update an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::update_by_query_with_relation (const QStringList &relation, const qx::QxSqlQuery &query, T &t)
| Update an element and its relationships (or a list of elements + relationships) into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::update_with_all_relation (T &t)
| Update an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
QSqlError | qx::dao::update_by_query_with_all_relation (const qx::QxSqlQuery &query, T &t)
| Update an element and all its relationships (or a list of elements + all relationships) into database (adding a user SQL query to the default SQL query builded by QxOrm library)
template<class T >
QSqlError | qx::dao::save_with_relation (const QString &relation, T &t)
| Insert (if no exist) or update (if already exist) an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::save_with_relation (const QStringList &relation, T &t)
| Insert (if no exist) or update (if already exist) an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError | qx::dao::save_with_all_relation (T &t)
| Insert (if no exist) or update (if already exist) an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
void | qx::dao::on_before_insert (T *t, qx::dao::detail::IxDao_Helper *dao)
| Callback before inserting an object into database (here is an example using QxOrm Trigger)
template<class T >
void | qx::dao::on_before_update (T *t, qx::dao::detail::IxDao_Helper *dao)
| Callback before updating an object into database (here is an example using QxOrm Trigger)
template<class T >
void | qx::dao::on_before_delete (T *t, qx::dao::detail::IxDao_Helper *dao)
| Callback before deleting an object into database (here is an example using QxOrm Trigger)
template<class T >
void | qx::dao::on_after_insert (T *t, qx::dao::detail::IxDao_Helper *dao)
| Callback after inserting an object into database (here is an example using QxOrm Trigger)
template<class T >
void | qx::dao::on_after_update (T *t, qx::dao::detail::IxDao_Helper *dao)
| Callback after updating an object into database (here is an example using QxOrm Trigger)
template<class T >
void | qx::dao::on_after_delete (T *t, qx::dao::detail::IxDao_Helper *dao)
| Callback after deleting an object into database (here is an example using QxOrm trigger)

## Detailed Description

Provide template functions to map C++ class registered into QxOrm context with table database (ORM - Object Relational Mapping)

Author:
  Lionel Marty

Definition in file QxDao.h.

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines