13#include "heart_global.h"
64 return static_cast<uint
>(type);
117 virtual void clear();
371 QDataStream &
fromStream(QDataStream &stream)
override;
372 QDataStream &
toStream(QDataStream &stream)
const override;
391 virtual std::pair<QString, QMap<QString, QVariant>>
condition()
const;
#define QH_PACKAGE(S)
QH_PACKAGE This macross prepare data to send and create a global id for package. For get global id us...
The DbAddress class use to work with database addresses. Database Address it is structure with 2 valu...
AbstractData()
AbstractData - Base constructor of this object.
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...
bool isHaveAPrimaryKey() const
isHaveAPrimaryKey This method return true if this object has a primary key. If you want to cache this...
virtual bool fromSqlRecord(const QSqlRecord &q)=0
fromSqlRecord This method should be initialize this object from the executed sqlRecord....
virtual PrepareResult prepareRemoveQuery(QSqlQuery &q) const
prepareRemoveQuery This method should be prepare a query for remove this object from a database....
virtual std::pair< QString, QMap< QString, QVariant > > condition() const
condition This method must to return a condition of the WHERE block of the sql query....
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
bool isInsertPrimaryKey() const
isInsertPrimaryKey This method check primaryKeys type. If the primary key have a type MemberType::Ins...
virtual DBVariantMap variantMap() const
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.
virtual void clear()
clear This method clear all data of database object. Override This method for remove or reset your ow...
virtual QString primaryKey() const
primaryKey This method must be return the name of primary key of this object table....
QString toString() const override
virtual PrepareResult prepareSelectQuery(QSqlQuery &q) const
prepareSelectQuery This method should be prepare a query for selected data. Override this method for ...
virtual PrepareResult prepareUpdateQuery(QSqlQuery &q) const
prepareUpdateQuery this method should be prepare a insert data query.
virtual PrepareResult prepareInsertQuery(QSqlQuery &q, bool replace) const
prepareInsertQuery This method should be prepare a query for insert object into database....
virtual bool isCached() const
isCached This method sholud be return status of object. If this method return true then this object c...
virtual bool isBundle() const
isBundle This method definef determines whether the object will be abstract (composite objects) or si...
virtual DBObject * createDBObject() const =0
createDBObject This method should be create a object with the some type as the object called this met...
bool isValid() const override
virtual QString table() const =0
table This method should be return name of the database table that should be contains objects with th...
virtual QVariant primaryValue() const
primaryValue This method is wraper of DBAddress::id. If This object do not contains a id value then r...
Q_DECLARE_METATYPE(QH::HostAddress)
The PKG namesapce - this namespace contains all default packages of the Heart library....
PrepareResult
The PrepareResult enum is result of work prepare sql query of dbobjects.
@ Success
prepare finished successful.
@ Disabled
prepare disabled for method. Use this case for disable prepare method for object without errors.
QMap< QString, DBVariant > DBVariantMap
DBVariantMap this is Map with key, and value with data type.
constexpr uint qHash(MemberType type)
MemberType
The MemberType enum. This enum contains types of members DBObjects classes. for more information see ...
@ PrimaryKey
The primary key field without autoincrement.
@ PrimaryKeyAutoIncrement
@ None
The Field with this type can not be update and Inserted.
@ Autoincement
The field with this atribute automaticaly incemented into database, and will not to added into insert...
@ InsertUpdate
The Field With This type can be inserted and updated.
@ Unique
The Field with this type can not be duplicate on a table. If a Database object do not have a primary ...
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
@ Update
Invoke the SqlDBWriter::updateObject method of a private database writer implementation.
@ Insert
Invoke the SqlDBWriter::insertObject method of a private database writer implementation.