8#ifndef DBOBJECTSREQUEST_H
9#define DBOBJECTSREQUEST_H
54 const QString& conditions =
"",
55 const QVariantMap& valuesToBind = {}):
58 _conditions = conditions;
59 _condirionValues = valuesToBind;
67 auto ptr = QSharedPointer<T>::create();
69 if (!ptr->fromSqlRecord(q)) {
83 QDataStream &
toStream(QDataStream &stream)
const override {
95 const QList<QSharedPointer<T>> &
data()
const {
100 return T{}.variantMap();
108 _conditions = newConditions;
113 std::pair<QString, QMap<QString, QVariant> >
condition()
const override {
114 return {_conditions, _condirionValues};
118 return create<DBObjectsRequest<T>>(
table(), _conditions);
125 QVariantMap _condirionValues;
The DBObjectSet class add features for control database object arrays. You will be able be get or rem...
QString table() const override
table This method should be return name of the database table that should be contains objects with th...
The DBObject class- main class for work with data base.
The DBObjectsRequest class is template class for get array of TEMPLATE Objects from database.
DBObject * createDBObject() const override
createDBObject This method should be create a object with the some type as the object called this met...
void clear() override
clear This method clear all data of database object. Override This method for remove or reset your ow...
DBObjectsRequest(const Package &pkkg)
DBObjectsRequest This is default constructor for parsing packages.
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
const QList< QSharedPointer< T > > & data() const
data This method return a list of getted objects.
DBVariantMap variantMap() const override
variantMap This method should be create a DBVariantMap implementation of this database object.
void setConditions(const QString &newConditions)
setConditions This method sets condition value for request.
QList< QSharedPointer< T > > _data
bool isValid() const override
isValid This method check current object to valid.
std::pair< QString, QMap< QString, QVariant > > condition() const override
condition This method must to return a condition of the WHERE block of the sql query....
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
bool fromSqlRecord(const QSqlRecord &q) override
fromSqlRecord This method should be initialize this object from the executed sqlRecord....
DBObjectsRequest(const QString &table, const QString &conditions="", const QVariantMap &valuesToBind={})
DBObjectsRequest This contsrucor create a object with request the array of T objects.
The Package struct. This is base structure for transporting data by network between QH nodes....
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.
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...