Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
getmaxintegerid.cpp
Go to the documentation of this file.
1#include "getmaxintegerid.h"
2
3#include <QSqlQuery>
4
5
6
7namespace QH {
8namespace PKG {
9
10
11GetMaxIntegerId::GetMaxIntegerId(const QString& table, const QString& field) {
12
13 _table = table;
14 _field = field;
15}
16
18 return _value;
19}
20
22 return create<GetMaxIntegerId>(table(), _field);
23}
24
26 QString queryString = "SELECT max(%0) FROM %1";
27
28 queryString = queryString.arg(_field, table());
29
30 if (!q.prepare(queryString)) {
32 }
33
35}
36
37bool GetMaxIntegerId::fromSqlRecord(const QSqlRecord &q) {
38 _value = q.value(0).toInt();
39 return true;
40}
41
43 return false;
44}
45
46QString GetMaxIntegerId::table() const {
47 return _table;
48}
49
50}
51}
The DBObject class- main class for work with data base.
Definition dbobject.h:94
bool fromSqlRecord(const QSqlRecord &q) override
fromSqlRecord This method should be initialize this object from the executed sqlRecord....
PrepareResult prepareSelectQuery(QSqlQuery &q) const override
prepareSelectQuery This method should be prepare a query for selected data. Override this method for ...
int value() const
value This method return Maximum value of a sql tables field.
DBObject * createDBObject() const override
createDBObject This method should be create a object with the some type as the object called this met...
QString table() const override
table This method should be return name of the database table that should be contains objects with th...
bool isCached() const override
isCached This method sholud be return status of object. If this method return true then this object c...
GetMaxIntegerId(const QString &table, const QString &field)
GetMaxIntegerId This is default constructor of the GetMaxIntegerId class.
PrepareResult
The PrepareResult enum is result of work prepare sql query of dbobjects.
Definition dbobject.h:24
@ Success
prepare finished successful.
@ Fail
prepare is failed.
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13