![]() |
QxOrm 1.4.9
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>
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, const QStringList &relation=QStringList()) |
| 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, const QStringList &relation=QStringList()) |
| 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, bool bUseExecBatch=false) |
| 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, bool bUseExecBatch=false) |
| 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, qx::dao::save_mode::e_save_mode eSaveRecursiveMode=qx::dao::save_mode::e_none) |
| Insert (if no exist) or update (if already exist) current instance into database. | |
| virtual QSqlError | qxDeleteById (const QVariant &id=QVariant(), QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false) |
| 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, bool bUseExecBatch=false) |
| 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 (bool bAsList=false) const |
| Create a new collection smart-pointer to fetch a list of items of current class type. | |
| virtual qx::IxClass * | qxClass () const |
| Access to introspection engine (or reflection engine) of QxOrm library. | |
| virtual QString | toJson (const QString &format=QString()) const |
| virtual QJsonValue | toJson_ (const QString &format=QString()) const |
| virtual qx_bool | fromJson (const QString &json, const QString &format=QString()) |
| virtual qx_bool | fromJson_ (const QJsonValue &json, const QString &format=QString()) |
Public Member Functions inherited from qx::IxPersistableCollection | |
| IxPersistableCollection () | |
| virtual | ~IxPersistableCollection () |
Public Member Functions inherited from qx::IxPersistable | |
| IxPersistable () | |
| virtual | ~IxPersistable () |
Public Member Functions inherited from qx::QxCollection< Key, Value > | |
| QxCollection () | |
| Construct an empty list. | |
| QxCollection (const QxCollection< Key, Value > &other) | |
| Construct a copy of 'other'. | |
| virtual | ~QxCollection () |
| Destroy the list. | |
| QxCollection< Key, Value > & | operator= (const QxCollection< Key, Value > &other) |
| Assign 'other' to this list and return a reference to this list. | |
| bool | operator== (const QxCollection< Key, Value > &other) const |
| Return 'true' if 'other' is equal to this list, otherwise return 'false' (same values in the same order) | |
| bool | operator!= (const QxCollection< Key, Value > &other) const |
| Return 'true' if 'other' is not equal to this list, otherwise return 'false'. | |
| iterator | begin () |
| Return an STL-style iterator pointing to the first item in the list. | |
| iterator | end () |
| Return an STL-style iterator pointing to the imaginary item after the last item in the list. | |
| const_iterator | begin () const |
| Return a const STL-style iterator pointing to the first item in the list. | |
| const_iterator | end () const |
| Return a const STL-style iterator pointing to the imaginary item after the last item in the list. | |
| reverse_iterator | rbegin () |
| Return a reverse STL-style iterator pointing to the first item in the list. | |
| reverse_iterator | rend () |
| Return a reverse STL-style iterator pointing to the imaginary item after the last item in the list. | |
| const_reverse_iterator | rbegin () const |
| Return a const reverse STL-style iterator pointing to the first item in the list. | |
| const_reverse_iterator | rend () const |
| Return a const reverse STL-style iterator pointing to the imaginary item after the last item in the list. | |
| void | reserve (long size) |
| Request that the capacity of the allocated storage space for the items of the container be at least enough to hold 'size' elements. | |
| void | reverse () |
| Reverse all items in the list. | |
| void | clear () |
| Remove all items from the list. | |
| long | count () const |
| Return the number of items in the list (same as 'size()') | |
| long | size () const |
| Return the number of items in the list (same as 'count()') | |
| bool | contains (const Key &key) const |
| Return 'true' if the list contains an occurrence of 'key', otherwise return 'false' (same as 'exist()') | |
| bool | exist (const Key &key) const |
| Return 'true' if the list contains an occurrence of 'key', otherwise return 'false' (same as 'contains()') | |
| bool | empty () const |
| Return 'true' if the list contains no items; otherwise return 'false'. | |
| bool | push_back (const Key &key, const Value &value) |
| Add element 'value' at the end of the list indexed by 'key'. | |
| bool | push_front (const Key &key, const Value &value) |
| Insert 'value' at the beginning of the list indexed by 'key'. | |
| bool | insert (const Key &key, const Value &value) |
| Add element 'value' at the end of the list indexed by 'key'. | |
| bool | insert (long index, const Key &key, const Value &value) |
| Insert element 'value' at position 'index' in the list indexed by 'key'. | |
| bool | insert (const QxCollection< Key, Value > &other) |
| Add all items of 'other' at the end of the list. | |
| bool | insert (long index, const QxCollection< Key, Value > &other) |
| Insert all items of 'other' at the end of the list. | |
| bool | replace (long index, const Key &key, const Value &value) |
| Replace the item at index position 'index' with element 'value' indexed by 'key'. | |
| bool | swap (long index1, long index2) |
| Exchange the item at index position 'index1' with the item at index position 'index2'. | |
| bool | move (long indexFrom, long indexTo) |
| Move the item at index position 'indexFrom' to index position 'indexTo'. | |
| bool | removeByKey (const Key &key) |
| Remove the item indexed by 'key' in the list. | |
| bool | removeByIndex (long index) |
| Remove the item at index position 'index'. | |
| bool | removeByIndex (long first, long last) |
| Remove all items from index position 'first' to index position 'last'. | |
| bool | removeFirst () |
| Remove the first item in the list. | |
| bool | removeLast () |
| Remove the last item in the list. | |
| const_reference_value | getByKey (const Key &key) const |
| Return the item associated with the 'key'. | |
| const_reference_value | getByIndex (long index) const |
| Return the item at index position 'index'. | |
| const_reference_value | getFirst () const |
| Return the first element in the list. | |
| const_reference_value | getLast () const |
| Return the last element in the list. | |
| const_reference_key | getKeyByIndex (long index) const |
| Return the key associated with the element at index position 'index'. | |
| void | sortByKey (bool bAscending=true) |
| Sort all items in the list using associated keys to compare. | |
| void | sortByValue (bool bAscending=true) |
| Sort all items in the list. | |
| template<typename Compare > | |
| void | sort (Compare comp) |
| virtual long | _count () const |
| virtual void | _clear () |
| virtual bool | _remove (long index) |
| virtual qx::any | _at (long index) const |
Public Member Functions inherited from qx::IxCollection | |
| IxCollection () | |
| virtual | ~IxCollection ()=0 |
| template<typename T > | |
| T | _get (long index) const |
Private Types | |
| enum | { qx_is_valid = qx::trait::is_qx_registered<T>::value } |
Additional Inherited Members | |
Public Types inherited from qx::QxCollection< Key, Value > | |
| typedef QPair< Key, Value > | type_pair_key_value |
| typedef type_list_pair_key_value::iterator | iterator |
| typedef type_list_pair_key_value::const_iterator | const_iterator |
| typedef type_list_pair_key_value::reverse_iterator | reverse_iterator |
| typedef type_list_pair_key_value::const_reverse_iterator | const_reverse_iterator |
| typedef const Key & | const_reference_key |
| typedef const Value & | const_reference_value |
Static Public Member Functions inherited from qx::IxPersistable | |
| static std::shared_ptr< qx::IxPersistableCollection > | qxFetchAll (const QString &className, const QStringList &columns=QStringList(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL, bool bAsList=false) |
| static std::shared_ptr< qx::IxPersistableCollection > | qxFetchByQuery (const QString &className, const qx::QxSqlQuery &query, const QStringList &columns=QStringList(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL, bool bAsList=false) |
| static std::shared_ptr< qx::IxPersistableCollection > | qxExecuteQuery (const QString &className, qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL, bool bAsList=false) |
Protected Types inherited from qx::QxCollection< Key, Value > | |
| typedef QList< type_pair_key_value > | type_list_pair_key_value |
| typedef QHash< Key, long > | type_hash_position |
Protected Member Functions inherited from qx::QxCollection< Key, Value > | |
| void | cloneCollection (QxCollection< Key, Value > *pClone, const QxCollection< Key, Value > &pRef) |
| bool | isSameCollection (const QxCollection< Key, Value > *p1, const QxCollection< Key, Value > &p2) const |
| void | updateHashPosition (long from=0, long to=-1, bool check=false) |
Protected Attributes inherited from qx::QxCollection< Key, Value > | |
| QMutex | m_mutex |
| Mutex => qx::QxCollection is thread-safe. | |
| type_list_pair_key_value | m_list |
| Container to keep insertion order. | |
| type_hash_position | m_hash |
| Container for fast search by key. | |
| bool | m_batch |
| Batch mode to sync internal containers. | |
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.
|
private |
| Enumerator | |
|---|---|
| qx_is_valid | |
Definition at line 88 of file IxPersistableCollection.h.
|
inline |
Definition at line 92 of file IxPersistableCollection.h.
|
inlinevirtual |
Definition at line 93 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistableCollection.
Definition at line 98 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistableCollection.
Definition at line 96 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistableCollection.
Definition at line 95 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistableCollection.
Definition at line 97 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistable.
Definition at line 205 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistable.
Definition at line 208 of file IxPersistableCollection.h.
|
inlinevirtual |
Access to introspection engine (or reflection engine) of QxOrm library.
Implements qx::IxPersistable.
Definition at line 194 of file IxPersistableCollection.h.
|
inlinevirtual |
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.
| 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 |
| relation | List of relationships keys to be fetched (eager fetch instead of default lazy fetch for a relation) |
qx::IxPersistable * p = ...;
p->qxCount(...) execute following SQL query :
SELECT COUNT(*) FROM my_table + XXX_JOINS_XXX + WHERE my_query...
Implements qx::IxPersistable.
Definition at line 100 of file IxPersistableCollection.h.
|
inlinevirtual |
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.
| 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 |
| 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 |
| relation | List of relationships keys to be fetched (eager fetch instead of default lazy fetch for a relation) |
qx::IxPersistable * p = ...;
p->qxCount(...) execute following SQL query :
SELECT COUNT(*) FROM my_table + XXX_JOINS_XXX + WHERE my_query...
Implements qx::IxPersistable.
Definition at line 106 of file IxPersistableCollection.h.
|
inlinevirtual |
Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context)
| 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 |
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 164 of file IxPersistableCollection.h.
|
inlinevirtual |
Delete current instance from database.
| id | Unique id to delete from database (if empty, check id of current instance) |
| 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 |
| bUseExecBatch | If true then use the QSqlQuery::execBatch() method to improve performance deleting a list of instances in database |
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 161 of file IxPersistableCollection.h.
|
inlinevirtual |
Delete all lines of a table (database) mapped to current C++ class (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 |
| 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 |
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 167 of file IxPersistableCollection.h.
|
inlinevirtual |
Delete all lines of a table (database) mapped to current C++ class (registered into QxOrm context)
| 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 |
qx::IxPersistable * p = ...;
p->qxDestroyAll(...) execute following SQL query :
DELETE FROM my_table
Implements qx::IxPersistable.
Definition at line 173 of file IxPersistableCollection.h.
|
inlinevirtual |
Delete current instance from database.
| id | Unique id to delete from database (if empty, check id of current instance) |
| 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 |
| bUseExecBatch | If true then use the QSqlQuery::execBatch() method to improve performance destroying a list of instances in database |
qx::IxPersistable * p = ...;
p->qxDestroyById(...) execute following SQL query :
DELETE FROM my_table WHERE my_id = ?
Implements qx::IxPersistable.
Definition at line 170 of file IxPersistableCollection.h.
|
inlinevirtual |
Delete all lines of a table (database) mapped to current C++ class (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 |
| 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 |
qx::IxPersistable * p = ...;
p->qxDestroyByQuery(...) execute following SQL query :
DELETE FROM my_table + WHERE my_query...
Implements qx::IxPersistable.
Definition at line 176 of file IxPersistableCollection.h.
|
inlinevirtual |
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.
| 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 |
Implements qx::IxPersistable.
Definition at line 179 of file IxPersistableCollection.h.
|
inlinevirtual |
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.
| query | Define a user SQL query added to default SQL query builded by QxOrm library |
| list | Container to fetch all items (retrieve all elements and properties associated); list is cleared before executing SQL query |
| 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 |
Implements qx::IxPersistable.
Definition at line 182 of file IxPersistableCollection.h.
|
inlinevirtual |
Search if current instance already exists into database.
| id | Unique id to check into database (if empty, check id of current instance) |
| 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 |
qx::IxPersistable * p = ...;
p->qxExist(...) execute following SQL query :
SELECT * FROM my_table WHERE my_id = ?
Implements qx::IxPersistable.
Definition at line 185 of file IxPersistableCollection.h.
|
inlinevirtual |
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.
| list | Container to fetch all items (retrieve all elements and properties associated); list is cleared before executing SQL query |
| columns | List of database table columns (mapped to properties of C++ class) to fetch (if empty, all columns are fetched) |
| relation | List 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 |
| 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 |
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 120 of file IxPersistableCollection.h.
|
inlinevirtual |
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)
| id | Unique id to fetch properties from database (if empty, check id of current instance) |
| columns | List of database table columns (mapped to properties of C++ class) to fetch (if empty, all columns are fetched) |
| relation | List 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 |
| 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 |
qx::IxPersistable * p = ...;
p->qxFetchById(...) execute following SQL query :
SELECT * FROM my_table WHERE my_id = ?
Implements qx::IxPersistable.
Definition at line 112 of file IxPersistableCollection.h.
|
inlinevirtual |
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.
| query | Define a user SQL query added to default SQL query builded by QxOrm library |
| list | Container to fetch all items (retrieve all elements and properties associated); list is cleared before executing SQL query |
| columns | List of database table columns (mapped to properties of C++ class) to fetch (if empty, all columns are fetched) |
| relation | List 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 |
| 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 |
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 128 of file IxPersistableCollection.h.
|
inlinevirtual |
Insert current instance into database.
| relation | List of relationships keys to insert 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 |
| bUseExecBatch | If true then use the QSqlQuery::execBatch() method to improve performance inserting a list of instances to database (but doesn't fill the last inserted identifier in the C++ instances) |
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 136 of file IxPersistableCollection.h.
|
inlinevirtual |
Create a new collection smart-pointer to fetch a list of items of current class type.
| bAsList | If true, returns a list (array) of persistent instances instead of key/value hash-map |
Implements qx::IxPersistable.
Definition at line 191 of file IxPersistableCollection.h.
|
inlinevirtual |
Insert (if no exist) or update (if already exist) current instance into database.
| relation | List of relationships keys to insert or update 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 |
| eSaveRecursiveMode | Parameter to call qx::dao::save_with_relation_recursive function |
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 152 of file IxPersistableCollection.h.
|
inlinevirtual |
Update current instance into database (you can add a user SQL query to the default SQL query builded by QxOrm library)
| query | Define a user SQL query added to default SQL query builded by QxOrm library |
| columns | List of database table columns (mapped to properties of C++ class) to update (if empty, all columns are updated) |
| relation | List of relationships keys to update 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 |
| bUseExecBatch | If true then use the QSqlQuery::execBatch() method to improve performance updating a list of instances in database |
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 144 of file IxPersistableCollection.h.
|
inlinevirtual |
Check if current instance is valid or not.
| groups | List of groups to check (defined into QxValidator module for current class) |
For more details about QxValidator module : https://www.qxorm.com/qxorm_en/faq.html#faq_250
Implements qx::IxPersistable.
Definition at line 188 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistable.
Definition at line 199 of file IxPersistableCollection.h.
|
inlinevirtual |
Implements qx::IxPersistable.
Definition at line 202 of file IxPersistableCollection.h.