Heart 1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Loading...
Searching...
No Matches
setsinglevalue.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2025 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#ifndef SETSINGLEVALUE_H
9#define SETSINGLEVALUE_H
10
11#include "dbobject.h"
12
13namespace QH {
14
15
16namespace PKG {
17
33class HEARTSHARED_EXPORT SetSingleValue final: public DBObject
34{
35public:
43 SetSingleValue(const DbAddress& address,
44 const QString& field,
45 const QVariant& value,
46 const QString& primaryKey = "id");
47
48 DBObject *createDBObject() const override;
49 PrepareResult prepareUpdateQuery(QSqlQuery &q) const override;
50 PrepareResult prepareInsertQuery(QSqlQuery &q, bool replace) const override;
51
52 bool fromSqlRecord(const QSqlRecord &q) override;
53 bool isCached() const override;
54
55 QString table() const override;
56
57
58protected:
59 QString primaryKey() const override;
60 QVariant primaryValue() const override;
61
62private:
63 QString _primaryKey;
64 QVariant _primaryValue;
65 QString _table;
66 QVariant _value;
67 QString _field;
68};
69
70}
71}
72#endif // SETSINGLEVALUE_H
The DbAddress class use to work with database addresses. Database Address it is structure with 2 valu...
Definition dbaddress.h:24
QVariant primaryValue() const override
primaryValue This method is wraper of DBAddress::id. If This object do not contains a id value then r...
QString table() const override
table This method should be return name of the database table that should be contains objects with th...
DBObject * createDBObject() const override
createDBObject This method should be create a object with the some type as the object called this met...
bool isCached() const override
isCached This method sholud be return status of object. If this method return true then this object c...
SetSingleValue(const DbAddress &address, const QString &field, const QVariant &value, const QString &primaryKey="id")
SetSingleValue This is default constructor of the update query generator.
bool fromSqlRecord(const QSqlRecord &q) override
fromSqlRecord This method should be initialize this object from the executed sqlRecord....
QString primaryKey() const override
primaryKey This method must be return the name of primary key of this object table....
PrepareResult prepareUpdateQuery(QSqlQuery &q) const override
prepareUpdateQuery this method should be prepare a insert data query.
PrepareResult prepareInsertQuery(QSqlQuery &q, bool replace) const override
prepareInsertQuery This method should be prepare a query for insert object into database....
The PKG namesapce - this namespace contains all default packages of the Heart library....
Definition heart.h:211
PrepareResult
The PrepareResult enum is result of work prepare sql query of dbobjects.
Definition dbobject.h:24
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13