QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
QxModelService.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** https://www.qxorm.com/
4** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
5**
6** This file is part of the QxOrm library
7**
8** This software is provided 'as-is', without any express or implied
9** warranty. In no event will the authors be held liable for any
10** damages arising from the use of this software
11**
12** Commercial Usage
13** Licensees holding valid commercial QxOrm licenses may use this file in
14** accordance with the commercial license agreement provided with the
15** Software or, alternatively, in accordance with the terms contained in
16** a written agreement between you and Lionel Marty
17**
18** GNU General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU
20** General Public License version 3.0 as published by the Free Software
21** Foundation and appearing in the file 'license.gpl3.txt' included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU General Public License version 3.0 requirements will be
24** met : http://www.gnu.org/copyleft/gpl.html
25**
26** If you are unsure which license is appropriate for your use, or
27** if you have questions regarding the use of this file, please contact :
28** contact@qxorm.com
29**
30****************************************************************************/
31
32#ifndef _QX_MODEL_SERVICE_H_
33#define _QX_MODEL_SERVICE_H_
34
35#ifdef _MSC_VER
36#pragma once
37#endif
38
46#include <QxModelView/QxModel.h>
47
48namespace qx {
49
57template <class T, class S, class B = qx::IxModel>
58class QxModelService : public qx::QxModel<T, B>
59{
60
61public:
62
66 typedef std::shared_ptr<type_collection> type_collection_ptr;
67 typedef B type_base_class;
68
69public:
70
71 QxModelService(QObject * parent = 0) : qx::QxModel<T, B>(parent) { ; }
72 QxModelService(qx::IxModel * other, QObject * parent) : qx::QxModel<T, B>(other, parent) { ; }
73 virtual ~QxModelService() { ; }
74
75 virtual long qxCount(const qx::QxSqlQuery & query = qx::QxSqlQuery(), QSqlDatabase * pDatabase = NULL)
76 {
77 long lCount = 0;
78 this->qxCount(lCount, query, pDatabase);
79 return lCount;
80 }
81
82 virtual QSqlError qxCount(long & lCount, const qx::QxSqlQuery & query = qx::QxSqlQuery(), QSqlDatabase * pDatabase = NULL)
83 {
84 Q_UNUSED(pDatabase);
85 S services;
86 this->m_lastError = services.count(lCount, query);
87 return this->m_lastError;
88 }
89
90 virtual QSqlError qxFetchById(const QVariant & id, const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
91 {
92 Q_UNUSED(pDatabase);
93 this->clear();
94 type_ptr pItem = type_ptr(new T());
95 if (! this->m_pDataMemberId) { qDebug("[QxOrm] problem with 'qxFetchById()' method : '%s'", "data member id not registered"); qAssert(false); }
96 if (! this->m_pDataMemberId) { this->m_lastError = QSqlError("[QxOrm] problem with 'qxFetchById()' method : 'data member id not registered'", "", QSqlError::UnknownError); return this->m_lastError; }
97 this->m_pDataMemberId->fromVariant(pItem.get(), id);
98
99 type_primary_key primaryKey;
100 qx::cvt::from_variant(id, primaryKey);
101 this->beginInsertRows(QModelIndex(), 0, 0);
102 this->m_model.insert(primaryKey, pItem);
103
104 S services;
105 this->m_lastError = services.fetchById(pItem, this->m_lstColumns, relation);
106 this->updateShowEmptyLine();
107 this->endInsertRows();
108 return this->m_lastError;
109 }
110
111 virtual QSqlError qxFetchAll(const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
112 {
113 Q_UNUSED(pDatabase);
114 this->clear();
115
116 S services;
117 type_collection_ptr tmp = std::make_shared<type_collection>();
118 this->m_lastError = services.fetchAll(tmp, this->m_lstColumns, relation);
119
120 if (tmp->count() <= 0) { return this->m_lastError; }
121 this->beginResetModel();
122 this->m_model = (* tmp);
123 this->updateShowEmptyLine();
124 this->endResetModel();
125 return this->m_lastError;
126 }
127
128 virtual QSqlError qxFetchByQuery(const qx::QxSqlQuery & query, const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
129 {
130 Q_UNUSED(pDatabase);
131 this->clear();
132
133 S services;
134 type_collection_ptr tmp = std::make_shared<type_collection>();
135 this->m_lastError = services.fetchByQuery(query, tmp, this->m_lstColumns, relation);
136
137 if (tmp->count() <= 0) { return this->m_lastError; }
138 this->beginResetModel();
139 this->m_model = (* tmp);
140 this->updateShowEmptyLine();
141 this->endResetModel();
142 return this->m_lastError;
143 }
144
145 virtual QSqlError qxFetchRow(int row, const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
146 {
147 Q_UNUSED(pDatabase);
148 if ((row < 0) || (row >= this->m_model.count())) { return QSqlError(); }
149 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return QSqlError(); }
150
151 S services;
152 this->m_lastError = services.fetchById(pItem, this->m_lstColumns, relation);
153 if (this->m_lastError.isValid()) { return this->m_lastError; }
154
155 QModelIndex idxTopLeft = this->index(row, 0);
156 QModelIndex idxBottomRight = this->index(row, (this->m_lstDataMember.count() - 1));
157 this->raiseEvent_dataChanged(idxTopLeft, idxBottomRight);
158 this->updateKey(row);
159 return this->m_lastError;
160 }
161
162 virtual QSqlError qxInsert(const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL, bool bUseExecBatch = false)
163 {
164 Q_UNUSED(pDatabase); Q_UNUSED(bUseExecBatch);
165 if (relation.count() > 0) { this->syncAllNestedModel(relation); }
166
167 type_collection_ptr tmp = std::make_shared<type_collection>();
168 (* tmp) = this->m_model;
169
170 S services;
171 this->m_lastError = services.insert(tmp, relation);
172
173 if (! this->m_lastError.isValid()) { this->updateAllKeys(); }
174 return this->m_lastError;
175 }
176
177 virtual QSqlError qxInsertRow(int row, const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
178 {
179 Q_UNUSED(pDatabase);
180 if ((row < 0) || (row >= this->m_model.count())) { return QSqlError(); }
181 if (relation.count() > 0) { this->syncNestedModel(row, relation); }
182 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return QSqlError(); }
183
184 S services;
185 this->m_lastError = services.insert(pItem, relation);
186
187 if (! this->m_lastError.isValid()) { this->updateKey(row); }
188 return this->m_lastError;
189 }
190
191 virtual QSqlError qxUpdate(const qx::QxSqlQuery & query = qx::QxSqlQuery(), const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL, bool bUseExecBatch = false)
192 {
193 Q_UNUSED(pDatabase); Q_UNUSED(bUseExecBatch);
194 if (relation.count() > 0) { this->syncAllNestedModel(relation); }
195
196 type_collection_ptr tmp = std::make_shared<type_collection>();
197 (* tmp) = this->m_model;
198
199 S services;
200 this->m_lastError = services.update(tmp, query, this->m_lstColumns, relation);
201
202 if (! this->m_lastError.isValid()) { this->updateAllKeys(); }
203 return this->m_lastError;
204 }
205
206 virtual QSqlError qxUpdateRow(int row, const qx::QxSqlQuery & query = qx::QxSqlQuery(), const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
207 {
208 Q_UNUSED(pDatabase);
209 if ((row < 0) || (row >= this->m_model.count())) { return QSqlError(); }
210 if (relation.count() > 0) { this->syncNestedModel(row, relation); }
211 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return QSqlError(); }
212
213 S services;
214 this->m_lastError = services.update(pItem, query, this->m_lstColumns, relation);
215
216 if (! this->m_lastError.isValid()) { this->updateKey(row); }
217 return this->m_lastError;
218 }
219
220 virtual QSqlError qxSave(const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
221 {
222 Q_UNUSED(pDatabase);
223 if (relation.count() > 0) { this->syncAllNestedModel(relation); }
224
225 type_collection_ptr tmp = std::make_shared<type_collection>();
226 (* tmp) = this->m_model;
227
228 S services;
229 this->m_lastError = services.save(tmp, relation);
230
231 if (! this->m_lastError.isValid()) { this->updateAllKeys(); }
232 return this->m_lastError;
233 }
234
235 virtual QSqlError qxSaveRow(int row, const QStringList & relation = QStringList(), QSqlDatabase * pDatabase = NULL)
236 {
237 Q_UNUSED(pDatabase);
238 if ((row < 0) || (row >= this->m_model.count())) { return QSqlError(); }
239 if (relation.count() > 0) { this->syncNestedModel(row, relation); }
240 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return QSqlError(); }
241
242 S services;
243 this->m_lastError = services.save(pItem, relation);
244
245 if (! this->m_lastError.isValid()) { this->updateKey(row); }
246 return this->m_lastError;
247 }
248
249 virtual QSqlError qxDeleteById(const QVariant & id, QSqlDatabase * pDatabase = NULL)
250 {
251 Q_UNUSED(pDatabase);
252 type_ptr pItem = type_ptr(new T());
253 if (! this->m_pDataMemberId) { qDebug("[QxOrm] problem with 'qxDeleteById()' method : '%s'", "data member id not registered"); qAssert(false); }
254 if (! this->m_pDataMemberId) { this->m_lastError = QSqlError("[QxOrm] problem with 'qxDeleteById()' method : 'data member id not registered'", "", QSqlError::UnknownError); return this->m_lastError; }
255 this->m_pDataMemberId->fromVariant(pItem.get(), id);
256
257 S services;
258 this->m_lastError = services.deleteById(pItem);
259 return this->m_lastError;
260 }
261
262 virtual QSqlError qxDeleteAll(QSqlDatabase * pDatabase = NULL)
263 {
264 Q_UNUSED(pDatabase);
265 S services;
266 this->m_lastError = services.deleteAll();
267 return this->m_lastError;
268 }
269
270 virtual QSqlError qxDeleteByQuery(const qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL)
271 {
272 Q_UNUSED(pDatabase);
273 S services;
274 this->m_lastError = services.deleteByQuery(query);
275 return this->m_lastError;
276 }
277
278 virtual QSqlError qxDeleteRow(int row, QSqlDatabase * pDatabase = NULL)
279 {
280 Q_UNUSED(pDatabase);
281 if ((row < 0) || (row >= this->m_model.count())) { return QSqlError(); }
282 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return QSqlError(); }
283
284 S services;
285 this->m_lastError = services.deleteById(pItem);
286 return this->m_lastError;
287 }
288
289 virtual QSqlError qxDestroyById(const QVariant & id, QSqlDatabase * pDatabase = NULL)
290 {
291 Q_UNUSED(pDatabase);
292 type_ptr pItem = type_ptr(new T());
293 if (! this->m_pDataMemberId) { qDebug("[QxOrm] problem with 'qxDeleteById()' method : '%s'", "data member id not registered"); qAssert(false); }
294 if (! this->m_pDataMemberId) { this->m_lastError = QSqlError("[QxOrm] problem with 'qxDeleteById()' method : 'data member id not registered'", "", QSqlError::UnknownError); return this->m_lastError; }
295 this->m_pDataMemberId->fromVariant(pItem.get(), id);
296
297 S services;
298 this->m_lastError = services.destroyById(pItem);
299 return this->m_lastError;
300 }
301
302 virtual QSqlError qxDestroyAll(QSqlDatabase * pDatabase = NULL)
303 {
304 Q_UNUSED(pDatabase);
305 S services;
306 this->m_lastError = services.destroyAll();
307 return this->m_lastError;
308 }
309
310 virtual QSqlError qxDestroyByQuery(const qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL)
311 {
312 Q_UNUSED(pDatabase);
313 S services;
314 this->m_lastError = services.destroyByQuery(query);
315 return this->m_lastError;
316 }
317
318 virtual QSqlError qxDestroyRow(int row, QSqlDatabase * pDatabase = NULL)
319 {
320 Q_UNUSED(pDatabase);
321 if ((row < 0) || (row >= this->m_model.count())) { return QSqlError(); }
322 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return QSqlError(); }
323
324 S services;
325 this->m_lastError = services.destroyById(pItem);
326 return this->m_lastError;
327 }
328
329 virtual QSqlError qxExecuteQuery(qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL)
330 {
331 Q_UNUSED(pDatabase);
332 this->clear();
333
334 S services;
335 type_collection_ptr tmp = std::make_shared<type_collection>();
336 this->m_lastError = services.executeQuery(query, tmp);
337
338 if (tmp->count() <= 0) { return this->m_lastError; }
339 this->beginResetModel();
340 this->m_model = (* tmp);
341 this->updateShowEmptyLine();
342 this->endResetModel();
343 return this->m_lastError;
344 }
345
346 virtual qx_bool qxExist(const QVariant & id, QSqlDatabase * pDatabase = NULL)
347 {
348 Q_UNUSED(pDatabase);
349 type_ptr pItem = type_ptr(new T());
350 if (! this->m_pDataMemberId) { qDebug("[QxOrm] problem with 'qxExist()' method : '%s'", "data member id not registered"); qAssert(false); }
351 if (! this->m_pDataMemberId) { return qx_bool(false); }
352 this->m_pDataMemberId->fromVariant(pItem.get(), id);
353
354 S services;
355 return services.exist(pItem);
356 }
357
358 virtual qx::QxInvalidValueX qxValidate(const QStringList & groups = QStringList())
359 {
360 Q_UNUSED(groups);
361 S services;
362 type_collection_ptr tmp = std::make_shared<type_collection>();
363 (* tmp) = this->m_model;
364 return services.isValid(tmp);
365 }
366
367 virtual qx::QxInvalidValueX qxValidateRow(int row, const QStringList & groups = QStringList())
368 {
369 Q_UNUSED(groups);
370 if ((row < 0) || (row >= this->m_model.count())) { return qx::QxInvalidValueX(); }
371 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return qx::QxInvalidValueX(); }
372
373 S services;
374 return services.isValid(pItem);
375 }
376
377protected:
378
379#ifndef _QX_NO_JSON
380
381 virtual QVariant getRelationshipValues_Helper(int row, const QString & relation, bool bLoadFromDatabase, const QString & sAppendRelations)
382 {
383 if ((row < 0) || (row >= this->m_model.count())) { return QVariant(); }
384 if (! this->m_pDataMemberId || ! this->m_pDataMemberX || ! this->m_pDataMemberX->exist(relation)) { return QVariant(); }
385 IxDataMember * pDataMember = this->m_pDataMemberX->get_WithDaoStrategy(relation); if (! pDataMember) { return QVariant(); }
386 IxSqlRelation * pRelation = (pDataMember->hasSqlRelation() ? pDataMember->getSqlRelation() : NULL); if (! pRelation) { return QVariant(); }
387 type_ptr pItem = this->m_model.getByIndex(row); if (! pItem) { return QVariant(); }
388 type_ptr pItemTemp = pItem;
389
390 if (bLoadFromDatabase)
391 {
392 QString sRelation = relation;
393 if (! sAppendRelations.isEmpty() && ! sAppendRelations.startsWith("->") && ! sAppendRelations.startsWith(">>")) { sRelation += "->" + sAppendRelations; }
394 else if (! sAppendRelations.isEmpty()) { sRelation += sAppendRelations; }
395 pItemTemp = type_ptr(new T());
396 QVariant id = this->m_pDataMemberId->toVariant(pItem.get());
397 this->m_pDataMemberId->fromVariant(pItemTemp.get(), id);
398
399 S services; QStringList columns;
400 QSqlError daoError = services.fetchById(pItemTemp, columns, QStringList() << sRelation);
401 if (daoError.isValid()) { return QVariant(); }
402 }
403
404 QJsonValue json = pDataMember->toJson(pItemTemp.get()); if (json.isNull()) { return QVariant(); }
405 if (json.isArray()) { return json.toArray().toVariantList(); }
406 return json.toObject().toVariantMap();
407 }
408
409#endif // _QX_NO_JSON
410
411};
412
413} // namespace qx
414
415#endif // _QX_MODEL_SERVICE_H_
qx::QxBool qx_bool
Definition QxBool.h:150
#define qAssert(x)
Definition QxMacro.h:52
All classes registered into QxOrm context can be used with Qt model/view architecture (Qt widgets and...
qx::IxDataMember : common interface for all class properties registered into QxOrm context
bool hasSqlRelation() const
virtual QJsonValue toJson(const void *pOwner, const QString &sFormat) const =0
virtual qx_bool fromVariant(void *pOwner, const QVariant &v, const QString &sFormat, int iIndexName=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)=0
IxSqlRelation * getSqlRelation() const
virtual QVariant toVariant(const void *pOwner, const QString &sFormat, int iIndexName=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context) const =0
bool exist(const QString &sKey) const
virtual IxDataMember * get_WithDaoStrategy(long lIndex) const =0
qx::IxModel : interface to manage Qt model/view architecture with classes registered into QxOrm conte...
Definition IxModel.h:163
void raiseEvent_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >())
QList< IxDataMember * > m_lstDataMember
List of data member exposed by the model.
Definition IxModel.h:187
QSqlError m_lastError
Last SQL error.
Definition IxModel.h:192
IxDataMemberX * m_pDataMemberX
List of properties defined into QxOrm context.
Definition IxModel.h:183
virtual void syncAllNestedModel(const QStringList &relation)
Q_INVOKABLE void clear(bool bUpdateColumns=false)
QStringList m_lstColumns
List of columns exposed by the model (if empty, all columns)
Definition IxModel.h:190
virtual QModelIndex parent(const QModelIndex &index) const
IxDataMember * m_pDataMemberId
Primary key (property id) defined into QxOrm context.
Definition IxModel.h:184
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
virtual void syncNestedModel(int row, const QStringList &relation)
qx::IxSqlRelation : common interface for all relationships defined between 2 classes (or between 2 ta...
qx_bool : boolean type with code and description message when an error occured
Definition QxBool.h:71
bool insert(const Key &key, const Value &value)
Add element 'value' at the end of the list indexed by 'key'.
long count() const
Return the number of items in the list (same as 'size()')
const_reference_value getByIndex(long index) const
Return the item at index position 'index'.
qx::QxInvalidValueX : list of invalid values
qx::QxModel<T, B> : all classes registered into QxOrm context can be used with Qt model/view architec...
Definition QxModel.h:164
virtual void updateShowEmptyLine()
Definition QxModel.h:644
qx::trait::get_primary_key< T >::type type_primary_key
Definition QxModel.h:173
std::shared_ptr< T > type_ptr
Definition QxModel.h:172
type_collection m_model
Definition QxModel.h:181
qx::QxModelService<T, S> : provides an easy way to connect your model to the QxService module (all qu...
std::shared_ptr< type_collection > type_collection_ptr
virtual QVariant getRelationshipValues_Helper(int row, const QString &relation, bool bLoadFromDatabase, const QString &sAppendRelations)
virtual ~QxModelService()
virtual QSqlError qxFetchByQuery(const qx::QxSqlQuery &query, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type...
QxModelService(qx::IxModel *other, QObject *parent)
virtual QSqlError qxUpdate(const qx::QxSqlQuery &query=qx::QxSqlQuery(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false)
Update all items in the model into database.
virtual QSqlError qxFetchRow(int row, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Get an item in the model at line row and fetch all its properties mapped to a table in the database,...
qx::QxModel< T, B >::type_primary_key type_primary_key
virtual QSqlError qxDeleteByQuery(const qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context) and fi...
QxModelService(QObject *parent=0)
virtual QSqlError qxDeleteRow(int row, QSqlDatabase *pDatabase=NULL)
Delete in database the item at line row in the model, if no error occurred then you should remove row...
qx::QxModel< T, B >::type_ptr type_ptr
virtual QSqlError qxInsertRow(int row, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Insert an item of the model at line row into database.
virtual QSqlError qxFetchById(const QVariant &id, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Clear the model and fetch an object (retrieve all its properties) of type T (registered into QxOrm co...
virtual QSqlError qxDestroyRow(int row, QSqlDatabase *pDatabase=NULL)
Delete in database (even if a logical delete is defined) the item at line row in the model,...
virtual qx_bool qxExist(const QVariant &id, QSqlDatabase *pDatabase=NULL)
virtual QSqlError qxDestroyByQuery(const qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered...
virtual qx::QxInvalidValueX qxValidate(const QStringList &groups=QStringList())
virtual QSqlError qxDeleteById(const QVariant &id, QSqlDatabase *pDatabase=NULL)
Delete a line of a table (database) mapped to a C++ object of type T (registered into QxOrm context),...
virtual QSqlError qxFetchAll(const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Clear the model and fetch a list of objects (retrieve all elements and properties associated) of type...
virtual QSqlError qxCount(long &lCount, const qx::QxSqlQuery &query=qx::QxSqlQuery(), QSqlDatabase *pDatabase=NULL)
Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm c...
virtual QSqlError qxSave(const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Save all items (insert or update) in the model into database.
virtual qx::QxInvalidValueX qxValidateRow(int row, const QStringList &groups=QStringList())
virtual QSqlError qxExecuteQuery(qx::QxSqlQuery &query, QSqlDatabase *pDatabase=NULL)
virtual QSqlError qxSaveRow(int row, const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Save an item of the model at line row into database.
virtual QSqlError qxDestroyById(const QVariant &id, QSqlDatabase *pDatabase=NULL)
Delete a line of a table (even if a logical delete is defined) mapped to a C++ object of type T (regi...
qx::QxModel< T, B >::type_collection type_collection
virtual QSqlError qxDestroyAll(QSqlDatabase *pDatabase=NULL)
Delete all lines of a table (even if a logical delete is defined) mapped to a C++ class T (registered...
virtual long qxCount(const qx::QxSqlQuery &query=qx::QxSqlQuery(), QSqlDatabase *pDatabase=NULL)
Return the number of lines in the table (database) mapped to the C++ class T (registered into QxOrm c...
virtual QSqlError qxUpdateRow(int row, const qx::QxSqlQuery &query=qx::QxSqlQuery(), const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL)
Update an item of the model at line row into database.
virtual QSqlError qxInsert(const QStringList &relation=QStringList(), QSqlDatabase *pDatabase=NULL, bool bUseExecBatch=false)
Insert all items in the model into database.
virtual QSqlError qxDeleteAll(QSqlDatabase *pDatabase=NULL)
Delete all lines of a table (database) mapped to a C++ class T (registered into QxOrm context),...
qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library,...
Definition QxSqlQuery.h:245
qx_bool from_variant(const QVariant &v, T &t, const QString &format=QString(), int index=-1, qx::cvt::context::ctx_type ctx=qx::cvt::context::e_no_context)
Definition QxConvert.h:80
Root namespace for all QxOrm library features.