19 const QString& primaryKey) {
21 _table = address.
table();
22 _primaryValue = address.
id();
32 return create<GetSingleValue>(
dbAddress(), _field);
36 QString queryString =
"SELECT %0 FROM %1 WHERE %2=:%2";
37 queryString = queryString.arg(_field,
table(), _primaryKey);
39 if (!q.prepare(queryString)) {
43 q.bindValue(
":" + _primaryKey, _primaryValue);
The DbAddress class use to work with database addresses. Database Address it is structure with 2 valu...
const QString & table() const
table This method return table name.
const QVariant & id() const
id This method return id of object in table.
The DBObject class- main class for work with data base.
DbAddress dbAddress() const
dbAddress This method return address of the database object. IF the object is not valid then this met...
GetSingleValue(const DbAddress &address, const QString &field, const QString &primaryKey="id")
GetSingleValue This is default constructor of the GetMaxIntegerId class.
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...
QVariant primaryValue() const override
primaryValue This method is wraper of DBAddress::id. If This object do not contains a id value then r...
DBObject * createDBObject() const override
createDBObject This method should be create a object with the some type as the object called this met...
QVariant value() const
value This method return Maximum value of a sql tables field.
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 ...
QString primaryKey() const override
primaryKey This method must be return the name of primary key of this object table....
PrepareResult
The PrepareResult enum is result of work prepare sql query of dbobjects.
@ Success
prepare finished successful.
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...