QxOrm  1.4.9
C++ Object Relational Mapping library

Database communication used by persistence engine (ORM - Object Relational Mapping) More...

Namespaces

namespace  detail
 

Internal helper tools for qx::dao namespace.


namespace  helper
namespace  throwable
 

Same functions as qx::dao namespace, but throw a qx::dao::sql_error exception when a SQL error occurred (instead of returning a QSqlError instance)


Classes

class  ptr
 qx::dao::ptr<T> : provide a classic smart-pointer (like boost::shared_ptr<T> or QSharedPointer<T>) with some features associated with QxDao module of QxOrm library More...
struct  strategy
 qx::dao::strategy : class inheritance strategy and database (Concrete Table Inheritance is the default strategy used by QxOrm library) More...
class  sql_error
 qx::dao::sql_error : define a SQL error exception and retrieve QSqlError type of Qt library More...
struct  sql_join
 qx::dao::sql_join : define how to join 2 tables into SQL query (LEFT OUTER JOIN, INNER JOIN, etc...) More...
struct  save_mode
 qx::dao::save_mode : to improve performance, if you know that you are just inserting or updating items in database More...

Functions

template<class T >
long count (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.
template<class T >
QSqlError count (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.
template<class T >
QSqlError count_with_relation (long &lCount, const QStringList &relation, 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 (with possibility to add relations to SQL query)
template<class T >
QSqlError insert (T &t, QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false)
 Insert an element or a list of elements into database.
template<class T >
QSqlError save (T &t, QSqlDatabase *pDatabase=NULL)
 Insert (if no exist) or update (if already exist) an element or a list of elements into database.
template<class T >
QSqlError delete_by_id (T &t, QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false)
 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 destroy_by_id (T &t, QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false)
 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 delete_all (QSqlDatabase *pDatabase=NULL)
 Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context)
template<class T >
QSqlError destroy_all (QSqlDatabase *pDatabase=NULL)
 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 delete_by_query (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.
template<class T >
QSqlError destroy_by_query (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
 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 create_table (QSqlDatabase *pDatabase=NULL)
 Create a table into database (with all columns) mapped to a C++ class T (registered into QxOrm context) : be careful, this function can be used only with a SQLite database to create examples or prototypes; For other databases, it is recommended to use QxEntityEditor application or to manage the database schema with an external tool provided by the SGBD (SQLite Manager for SQLite, pgAdmin for PostgreSQL, MySQL Workbench for MySQL, etc...)
template<class T >
qx_bool exist (T &t, QSqlDatabase *pDatabase=NULL)
 Search if an element (or list of elements) already exists into database.
template<class T >
QSqlError fetch_by_id_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_by_id_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_by_id_with_all_relation (T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_all_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_all_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_all_with_all_relation (T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_by_query_with_relation (const QString &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_by_query_with_relation (const QStringList &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL)
 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 fetch_by_query_with_all_relation (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL)
 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 insert_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase=NULL)
 Insert an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError insert_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase=NULL)
 Insert an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError insert_with_all_relation (T &t, QSqlDatabase *pDatabase=NULL)
 Insert an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
QSqlError update_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase=NULL)
 Update an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError update_by_query_with_relation (const QString &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL)
 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 update_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase=NULL)
 Update an element and its relationships (or a list of elements + relationships) into database.
template<class T >
QSqlError update_by_query_with_relation (const QStringList &relation, const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL)
 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 update_with_all_relation (T &t, QSqlDatabase *pDatabase=NULL)
 Update an element and all its relationships (or a list of elements + all relationships) into database.
template<class T >
QSqlError update_by_query_with_all_relation (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL)
 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 save_with_relation (const QString &relation, T &t, QSqlDatabase *pDatabase=NULL)
 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 save_with_relation (const QStringList &relation, T &t, QSqlDatabase *pDatabase=NULL)
 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 save_with_all_relation (T &t, QSqlDatabase *pDatabase=NULL)
 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 >
QSqlError save_with_relation_recursive (T &t, qx::dao::save_mode::e_save_mode eSaveMode=qx::dao::save_mode::e_check_insert_or_update, QSqlDatabase *pDatabase=NULL, qx::QxSqlRelationParams *pRelationParams=NULL)
 Insert (if no exist) or update (if already exist) recursively an element and all levels of relationships (or a list of elements + all levels of relationships) into database, useful to save a tree structure for example.
template<class T >
QSqlError fetch_by_id (T &t, QSqlDatabase *pDatabase=NULL, const QStringList &columns=QStringList())
 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 fetch_all (T &t, QSqlDatabase *pDatabase=NULL, const QStringList &columns=QStringList())
 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 fetch_by_query (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL, const QStringList &columns=QStringList())
 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 update (T &t, QSqlDatabase *pDatabase=NULL, const QStringList &columns=QStringList(), bool bUseExecBatch=false)
 Update an element or a list of elements into database.
template<class T >
QSqlError update_by_query (const qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL, const QStringList &columns=QStringList(), bool bUseExecBatch=false)
 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 update_optimized (qx::dao::ptr< T > &ptr, QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false)
 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 update_optimized_by_query (const qx::QxSqlQuery &query, qx::dao::ptr< T > &ptr, QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false)
 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 execute_query (qx::QxSqlQuery &query, T &t, QSqlDatabase *pDatabase=NULL)
 Execute a custom SQL query or a stored procedure, all columns that can be mapped to the instance of type T will be fetched automatically.
template<class T >
void 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 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 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 on_before_fetch (T *t, qx::dao::detail::IxDao_Helper *dao)
 Callback before fetching an object from database (here is an example using QxOrm Trigger)
template<class T >
void 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 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 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)
template<class T >
void on_after_fetch (T *t, qx::dao::detail::IxDao_Helper *dao)
 Callback after fetching an object from database (here is an example using QxOrm trigger)
QX_DLL_EXPORT QSqlError call_query (qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
 qx::dao::call_query function can be used to call a custom SQL query or a stored procedure
QX_DLL_EXPORT QSqlError call_query_without_prepare (qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
 qx::dao::call_query_without_prepare function can be used to call a custom SQL query or a stored procedure : same as qx::dao::call_query() function without calling prepare() QSqlQuery class method (can be useful to execute some specific SQL queries)

Detailed Description

Database communication used by persistence engine (ORM - Object Relational Mapping)