QxOrm  1.4.5
C++ Object Relational Mapping library

qx::QxPersistableCollection<Key, Value, T> : concrete class for collection persistent classes based on qx::IxPersistableCollection and qx::QxCollection<Key, Value> More...

#include <IxPersistableCollection.h>

Inheritance diagram for qx::QxPersistableCollection< Key, Value, T >:
qx::IxPersistableCollection qx::QxCollection< Key, Value > qx::IxPersistable qx::IxCollection

List of all members.

Public Member Functions

 QxPersistableCollection ()
virtual ~QxPersistableCollection ()
virtual long __count () const
virtual void __clear ()
virtual bool __remove (long idx)
virtual qx::IxPersistable_ptr __at (long idx) const
virtual long qxCount (const qx::QxSqlQuery &query=qx::QxSqlQuery(), QSqlDatabase *pDatabase=NULL)
 Return the number of lines in the table (database) mapped to the current C++ class (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 current C++ class (registered into QxOrm context) and filtered by a user SQL query.
virtual QSqlError qxFetchById (const QVariant &id=QVariant(), const QStringList &columns=QStringList(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
 Fetch current instance (retrieve all its properties) mapped to a table in the database (current instance must have a valid id before to be fetched without error, or pass the id to the first parameter of this method)
virtual QSqlError qxFetchAll (qx::IxPersistableCollection *list=NULL, const QStringList &columns=QStringList(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
 Fetch a list of objects (retrieve all elements and properties associated) of current type (container registered into QxOrm context) mapped to a table in the database.
virtual QSqlError qxFetchByQuery (const qx::QxSqlQuery &query, qx::IxPersistableCollection *list=NULL, const QStringList &columns=QStringList(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
 Fetch a list of objects (retrieve all elements and properties associated) of current type (container registered into QxOrm context) mapped to a table in the database and filtered by a user SQL query.
virtual QSqlError qxInsert (const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
 Insert current instance into database.
virtual QSqlError qxUpdate (const qx::QxSqlQuery &query=qx::QxSqlQuery(), const QStringList &columns=QStringList(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
 Update current instance into database (you can add a user SQL query to the default SQL query builded by QxOrm library)
virtual QSqlError qxSave (const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
 Insert (if no exist) or update (if already exist) current instance into database.
virtual QSqlError qxDeleteById (const QVariant &id=QVariant(), QSqlDatabase *pDatabase=NULL)
 Delete current instance from database.
virtual QSqlError qxDeleteAll (QSqlDatabase *pDatabase=NULL)
 Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context)
virtual QSqlError qxDeleteByQuery (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
 Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context) and filtered by a user SQL query.
virtual QSqlError qxDestroyById (const QVariant &id=QVariant(), QSqlDatabase *pDatabase=NULL)
 Delete current instance from database.
virtual QSqlError qxDestroyAll (QSqlDatabase *pDatabase=NULL)
 Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context)
virtual QSqlError qxDestroyByQuery (const qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
 Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context) and filtered by a user SQL query.
virtual QSqlError qxExecuteQuery (qx::QxSqlQuery &query, 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.
virtual QSqlError qxExecuteQuery (qx::QxSqlQuery &query, qx::IxPersistableCollection *list=NULL, 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.
virtual qx_bool qxExist (const QVariant &id=QVariant(), QSqlDatabase *pDatabase=NULL)
 Search if current instance already exists into database.
virtual qx::QxInvalidValueX qxValidate (const QStringList &groups=QStringList())
 Check if current instance is valid or not.
virtual std::shared_ptr
< qx::IxPersistableCollection
qxNewPersistableCollection () const
 Create a new collection smart-pointer to fetch a list of items of current class type.
virtual qx::IxClassqxClass () const
 Access to introspection engine (or reflection engine) of QxOrm library.
virtual QString toJson (const QString &format=QString()) const
virtual qx_bool fromJson (const QString &json, const QString &format=QString())

Private Types

enum  { qx_is_valid = qx::trait::is_qx_registered<T>::value }

Detailed Description

template<typename Key, typename Value, typename T>
class qx::QxPersistableCollection< Key, Value, T >

qx::QxPersistableCollection<Key, Value, T> : concrete class for collection persistent classes based on qx::IxPersistableCollection and qx::QxCollection<Key, Value>

Definition at line 85 of file IxPersistableCollection.h.


Member Enumeration Documentation

template<typename Key , typename Value , typename T >
anonymous enum [private]
Enumerator:
qx_is_valid 

Definition at line 88 of file IxPersistableCollection.h.


Constructor & Destructor Documentation

template<typename Key , typename Value , typename T >
qx::QxPersistableCollection< Key, Value, T >::QxPersistableCollection ( ) [inline]

Definition at line 92 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual qx::QxPersistableCollection< Key, Value, T >::~QxPersistableCollection ( ) [inline, virtual]

Definition at line 93 of file IxPersistableCollection.h.


Member Function Documentation

template<typename Key , typename Value , typename T >
virtual qx::IxPersistable_ptr qx::QxPersistableCollection< Key, Value, T >::__at ( long  idx) const [inline, virtual]

Implements qx::IxPersistableCollection.

Definition at line 98 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual void qx::QxPersistableCollection< Key, Value, T >::__clear ( ) [inline, virtual]

Implements qx::IxPersistableCollection.

Definition at line 96 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual long qx::QxPersistableCollection< Key, Value, T >::__count ( ) const [inline, virtual]

Implements qx::IxPersistableCollection.

Definition at line 95 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual bool qx::QxPersistableCollection< Key, Value, T >::__remove ( long  idx) [inline, virtual]

Implements qx::IxPersistableCollection.

Definition at line 97 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual qx_bool qx::QxPersistableCollection< Key, Value, T >::fromJson ( const QString &  json,
const QString &  format = QString() 
) [inline, virtual]

Implements qx::IxPersistable.

Definition at line 195 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual qx::IxClass* qx::QxPersistableCollection< Key, Value, T >::qxClass ( ) const [inline, virtual]

Access to introspection engine (or reflection engine) of QxOrm library.

Returns:
Return a qx::IxClass pointer to access to introspection engine (or reflection engine) of QxOrm library, and get some informations about current class (properties, methods, etc...)

Implements qx::IxPersistable.

Definition at line 187 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual long qx::QxPersistableCollection< Key, Value, T >::qxCount ( const qx::QxSqlQuery query = qx::QxSqlQuery(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Return the number of lines in the table (database) mapped to the current C++ class (registered into QxOrm context) and filtered by a user SQL query.

Parameters:
queryDefine a user SQL query added to default SQL query builded by QxOrm library
pDatabaseConnection 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

qx::IxPersistable * p = ...;
p->qxCount(...) execute following SQL query :
SELECT COUNT(*) FROM my_table + WHERE my_query...

Implements qx::IxPersistable.

Definition at line 100 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::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 current C++ class (registered into QxOrm context) and filtered by a user SQL query.

Parameters:
lCountOutput parameter with the number of lines in the table associated to the SQL query
queryDefine a user SQL query added to default SQL query builded by QxOrm library
pDatabaseConnection 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

qx::IxPersistable * p = ...;
p->qxCount(...) execute following SQL query :
SELECT COUNT(*) FROM my_table + WHERE my_query...

Implements qx::IxPersistable.

Definition at line 103 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxDeleteAll ( QSqlDatabase *  pDatabase = NULL) [inline, virtual]

Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context)

Parameters:
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxDeleteAll(...) execute following SQL query :
DELETE FROM my_table

If a soft delete behavior is defined for current class, p->qxDeleteAll(...) execute following SQL query :
UPDATE my_table SET is_deleted='1'

Implements qx::IxPersistable.

Definition at line 157 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxDeleteById ( const QVariant &  id = QVariant(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Delete current instance from database.

Parameters:
idUnique id to delete from database (if empty, check id of current instance)
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxDeleteById(...) execute following SQL query :
DELETE FROM my_table WHERE my_id = ?

If a soft delete behavior is defined for current class, p->qxDeleteById(...) execute following SQL query :
UPDATE my_table SET is_deleted='1' WHERE my_id = ?

Implements qx::IxPersistable.

Definition at line 154 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxDeleteByQuery ( const qx::QxSqlQuery query,
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context) and filtered by a user SQL query.

Parameters:
queryDefine a user SQL query added to default SQL query builded by QxOrm library
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxDeleteByQuery(...) execute following SQL query :
DELETE FROM my_table + WHERE my_query...

If a soft delete behavior is defined for current class, p->qxDeleteByQuery(...) execute following SQL query :
UPDATE my_table SET is_deleted='1' + WHERE my_query...

Implements qx::IxPersistable.

Definition at line 160 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxDestroyAll ( QSqlDatabase *  pDatabase = NULL) [inline, virtual]

Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context)

Parameters:
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxDestroyAll(...) execute following SQL query :
DELETE FROM my_table

Implements qx::IxPersistable.

Definition at line 166 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxDestroyById ( const QVariant &  id = QVariant(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Delete current instance from database.

Parameters:
idUnique id to delete from database (if empty, check id of current instance)
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxDestroyById(...) execute following SQL query :
DELETE FROM my_table WHERE my_id = ?

Implements qx::IxPersistable.

Definition at line 163 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxDestroyByQuery ( const qx::QxSqlQuery query,
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context) and filtered by a user SQL query.

Parameters:
queryDefine a user SQL query added to default SQL query builded by QxOrm library
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxDestroyByQuery(...) execute following SQL query :
DELETE FROM my_table + WHERE my_query...

Implements qx::IxPersistable.

Definition at line 169 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxExecuteQuery ( qx::QxSqlQuery query,
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

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.

Parameters:
queryDefine a user SQL query added to default SQL query builded by QxOrm library
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

Implements qx::IxPersistable.

Definition at line 172 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxExecuteQuery ( qx::QxSqlQuery query,
qx::IxPersistableCollection list = NULL,
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

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.

Parameters:
queryDefine a user SQL query added to default SQL query builded by QxOrm library
listContainer to fetch all items (retrieve all elements and properties associated); list is cleared before executing SQL query
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

Implements qx::IxPersistable.

Definition at line 175 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual qx_bool qx::QxPersistableCollection< Key, Value, T >::qxExist ( const QVariant &  id = QVariant(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Search if current instance already exists into database.

Parameters:
idUnique id to check into database (if empty, check id of current instance)
pDatabaseConnection 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
Returns:
Return true if element already exists into database; otherwise return false; if an error occurred, qx_bool object contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxExist(...) execute following SQL query :
SELECT * FROM my_table WHERE my_id = ?

Implements qx::IxPersistable.

Definition at line 178 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxFetchAll ( qx::IxPersistableCollection list = NULL,
const QStringList &  columns = QStringList(),
const QStringList &  relation = QStringList(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Fetch a list of objects (retrieve all elements and properties associated) of current type (container registered into QxOrm context) mapped to a table in the database.

Parameters:
listContainer to fetch all items (retrieve all elements and properties associated); list is cleared before executing SQL query
columnsList of database table columns (mapped to properties of C++ class) to fetch (if empty, all columns are fetched)
relationList of relationships keys to fetch (eager fetch instead of default lazy fetch for a relation) : use "|" separator to put many relationships keys into this parameter
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
std::shared_ptr<qx::IxPersistableCollection> lst = p->qxNewPersistableCollection();
p->qxFetchAll(& lst, ...) execute following SQL query :
SELECT * FROM my_table

Implements qx::IxPersistable.

Definition at line 114 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxFetchById ( const QVariant &  id = QVariant(),
const QStringList &  columns = QStringList(),
const QStringList &  relation = QStringList(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Fetch current instance (retrieve all its properties) mapped to a table in the database (current instance must have a valid id before to be fetched without error, or pass the id to the first parameter of this method)

Parameters:
idUnique id to fetch properties from database (if empty, check id of current instance)
columnsList of database table columns (mapped to properties of C++ class) to fetch (if empty, all columns are fetched)
relationList of relationships keys to fetch (eager fetch instead of default lazy fetch for a relation) : use "|" separator to put many relationships keys into this parameter
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxFetchById(...) execute following SQL query :
SELECT * FROM my_table WHERE my_id = ?

Implements qx::IxPersistable.

Definition at line 106 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxFetchByQuery ( const qx::QxSqlQuery query,
qx::IxPersistableCollection list = NULL,
const QStringList &  columns = QStringList(),
const QStringList &  relation = QStringList(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Fetch a list of objects (retrieve all elements and properties associated) of current type (container registered into QxOrm context) mapped to a table in the database and filtered by a user SQL query.

Parameters:
queryDefine a user SQL query added to default SQL query builded by QxOrm library
listContainer to fetch all items (retrieve all elements and properties associated); list is cleared before executing SQL query
columnsList of database table columns (mapped to properties of C++ class) to fetch (if empty, all columns are fetched)
relationList of relationships keys to fetch (eager fetch instead of default lazy fetch for a relation) : use "|" separator to put many relationships keys into this parameter
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
std::shared_ptr<qx::IxPersistableCollection> lst = p->qxNewPersistableCollection();
p->qxFetchByQuery(my_query, & lst, ...) execute following SQL query :
SELECT * FROM my_table + WHERE my_query...

Implements qx::IxPersistable.

Definition at line 122 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxInsert ( const QStringList &  relation = QStringList(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Insert current instance into database.

Parameters:
relationList of relationships keys to insert in others tables of database : use "|" separator to put many relationships keys into this parameter
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxInsert(...) execute following SQL query :
INSERT INTO my_table (my_column_1, my_column_2, etc.) VALUES (?, ?, etc.)

Implements qx::IxPersistable.

Definition at line 130 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual std::shared_ptr<qx::IxPersistableCollection> qx::QxPersistableCollection< Key, Value, T >::qxNewPersistableCollection ( ) const [inline, virtual]

Create a new collection smart-pointer to fetch a list of items of current class type.

Returns:
Return a new collection smart-pointer to fetch a list of items of current class type

Implements qx::IxPersistable.

Definition at line 184 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxSave ( const QStringList &  relation = QStringList(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Insert (if no exist) or update (if already exist) current instance into database.

Parameters:
relationList of relationships keys to insert or update in others tables of database : use "|" separator to put many relationships keys into this parameter
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxSave(...) execute following SQL query :
INSERT INTO my_table (my_column_1, my_column_2, etc.) VALUES (?, ?, etc.)
or (if already exist into database) :
UPDATE my_table SET my_column_1 = ?, my_column_2 = ?, etc.

Implements qx::IxPersistable.

Definition at line 146 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QSqlError qx::QxPersistableCollection< Key, Value, T >::qxUpdate ( const qx::QxSqlQuery query = qx::QxSqlQuery(),
const QStringList &  columns = QStringList(),
const QStringList &  relation = QStringList(),
QSqlDatabase *  pDatabase = NULL 
) [inline, virtual]

Update current instance into database (you can add a user SQL query to the default SQL query builded by QxOrm library)

Parameters:
queryDefine a user SQL query added to default SQL query builded by QxOrm library
columnsList of database table columns (mapped to properties of C++ class) to update (if empty, all columns are updated)
relationList of relationships keys to update in others tables of database : use "|" separator to put many relationships keys into this parameter
pDatabaseConnection 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
Returns:
Empty QSqlError object (from Qt library) if no error occurred; otherwise QSqlError contains a description of database error executing SQL query

qx::IxPersistable * p = ...;
p->qxUpdate(...) execute following SQL query :
UPDATE my_table SET my_column_1 = ?, my_column_2 = ?, etc. + WHERE my_query...

Implements qx::IxPersistable.

Definition at line 138 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual qx::QxInvalidValueX qx::QxPersistableCollection< Key, Value, T >::qxValidate ( const QStringList &  groups = QStringList()) [inline, virtual]

Check if current instance is valid or not.

Parameters:
groupsList of groups to check (defined into QxValidator module for current class)
Returns:
Return list of invalid values (if empty, current instance is valid)

For more details about QxValidator module : https://www.qxorm.com/qxorm_en/faq.html#faq_250

Implements qx::IxPersistable.

Definition at line 181 of file IxPersistableCollection.h.

template<typename Key , typename Value , typename T >
virtual QString qx::QxPersistableCollection< Key, Value, T >::toJson ( const QString &  format = QString()) const [inline, virtual]

Implements qx::IxPersistable.

Definition at line 192 of file IxPersistableCollection.h.


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