Heart 1.3.842.34c2ab5
Heart is base back end library for your c++ Qt projects.
deleteobject.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2024 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#include "deleteobject.h"
9namespace QH {
10namespace PKG {
14
15DeleteObject::DeleteObject(const DbAddress &address, const QString &primaryKey) {
16 _primaryKey = primaryKey;
17 _address = address;
18}
19
23
25 return create<DeleteObject>();
26}
27
29 return {};
30}
31
33 return _token;
34}
35
37 _token = token;
38}
39
40bool DeleteObject::fromSqlRecord(const QSqlRecord &q) {
41 Q_UNUSED(q);
42 return true;
43}
44
45QDataStream &DeleteObject::fromStream(QDataStream &stream) {
46
47 stream >> _address;
48 stream >> _token;
49 stream >> _primaryKey;
50
51 return stream;
52}
53
54QDataStream &DeleteObject::toStream(QDataStream &stream) const {
55 stream << _address;
56 stream << _token;
57 stream << _primaryKey;
58
59 return stream;
60}
61
62void DeleteObject::setPrimaryKey(const QString &newPrimaryKey) {
63 _primaryKey = newPrimaryKey;
64}
65
67 return false;
68}
69
70QString DeleteObject::table() const {
71 return _address.table();
72}
73
75 return _address;
76}
77
78void DeleteObject::setAddress(const DbAddress &newAddress) {
79 _address = newAddress;
80}
81
82QString DeleteObject::primaryKey() const {
83 return _primaryKey;
84}
85
87 return _address.id();
88}
89
90}
91}
The AccessToken class contains information duration of the access. Token are byte array for validatio...
Definition accesstoken.h:25
The DbAddress class use to work with database addresses. Database Address it is structure with 2 valu...
Definition dbaddress.h:24
const QString & table() const
table This method return table name.
Definition dbaddress.cpp:58
const QVariant & id() const
id This method return id of object in table.
Definition dbaddress.cpp:67
The DBObject class- main class for work with data base.
Definition dbobject.h:94
The DeleteObject class is request for update object with dbId;.
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
DBVariantMap variantMap() const override
variantMap This method should be create a DBVariantMap implementation of this database object.
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
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...
bool isCached() const override
isCached This method sholud be return status of object. If this method return true then this object c...
const AccessToken & getSignToken() const override
getSignToken This method should be return actually token of the user.
const DbAddress & address() const
address This method return address of the object that will be deleted.
bool fromSqlRecord(const QSqlRecord &q) override
fromSqlRecord This method should be initialize this object from the executed sqlRecord....
void setSignToken(const AccessToken &token) override
setSignToken This method sets a new token for object.
void setAddress(const DbAddress &newAddress)
setAddress This method sets new address for object that will be deleted from database.
QString table() const override
table This method should be return name of the database table that should be contains objects with th...
QString primaryKey() const override
primaryKey This method must be return the name of primary key of this object table....
void setPrimaryKey(const QString &newPrimaryKey)
setPrimaryKey This meethod sets new value of the primary key.
The Package struct. This is base structure for transporting data by network between QH nodes....
Definition package.h:23
bool fromBytes(const QByteArray &data)
fromBytes This method provide initialization of object from byte array.
QByteArray toBytes() const
toBytes This method convert a current object to bytes array.
QMap< QString, DBVariant > DBVariantMap
DBVariantMap this is Map with key, and value with data type.
Definition dbobject.h:84
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13