99 QList<QSharedPointer<QH::PKG::DBObject>> &result)
override;
101 bool updateObject(
const QSharedPointer<QH::PKG::DBObject>& saveObject,
102 bool wait =
false)
override;
103 bool deleteObject(
const QSharedPointer<QH::PKG::DBObject>& delObj,
104 bool wait =
false)
override;
105 bool insertObject(
const QSharedPointer<QH::PKG::DBObject>& saveObject,
107 const QWeakPointer<unsigned int>& autoincrementIdResult = {})
override;
109 bool replaceObject(
const QSharedPointer<QH::PKG::DBObject>& saveObject,
110 bool wait =
false)
override;
112 bool doQuery(
const QString &query,
const QVariantMap& bindValues,
113 bool wait =
false, QSqlQuery* result =
nullptr)
const override;
115 bool doSql(
const QString &sqlFile,
bool wait)
const override;
125 const std::function<
bool (
const QSharedPointer<PKG::DBObject> &)> &changeAction);
130 qint64 getUpdateInterval()
const;
136 void setUpdateInterval(
const qint64 &value);
143 virtual bool init(
const QString &initDbParams =
"");
150 virtual bool init(
const QVariantMap ¶ms);
152 void setSQLSources(
const QStringList &list)
override;
155 void prepareForDelete()
override;
161 qint64 getLastUpdateTime()
const;
167 void setLastUpdateTime(
const qint64 &value);
182 virtual bool insertToCache(
const QSharedPointer<QH::PKG::DBObject> &obj) = 0;
189 virtual bool updateCache(
const QSharedPointer<QH::PKG::DBObject> &obj) = 0;
196 virtual QList<QSharedPointer<QH::PKG::DBObject>>
204 virtual void pushToQueue(
const QSharedPointer<QH::PKG::DBObject> &obj,
224 virtual void globalUpdateDataBasePrivate(qint64 currentTime);
230 virtual void globalUpdateDataBase(
SqlDBCasheWriteMode mode = SqlDBCasheWriteMode::Default);
234 bool updateObjectP(
const QSharedPointer<QH::PKG::DBObject>& saveObject,
236 bool deleteObjectP(
const QSharedPointer<QH::PKG::DBObject>& delObj,
238 bool insertObjectP(
const QSharedPointer<QH::PKG::DBObject>& saveObject,
240 const QWeakPointer<unsigned int>& autoincrementIdResult);
241 bool replaceObjectP(
const QSharedPointer<QH::PKG::DBObject>& saveObject,
244 qint64 lastUpdateTime = 0;
251 QHash<CacheAction, QSharedPointer<QH::PKG::DBObject>> _changes;
252 QMutex _saveLaterMutex;
279 return static_cast<uint
>(action);
The DbAddress class use to work with database addresses. Database Address it is structure with 2 valu...
The ISqlDB class it is db cache and bridge for DbWriters. Work Scheme of the database cache:
virtual QList< QSharedPointer< QH::PKG::DBObject > > getFromCache(const PKG::DBObject *obj)=0
getFromCache This method return strong pointer to the database object from cache (pool).
void sigItemChanged(const QSharedPointer< QH::PKG::DBObject > &obj)
sigItemChanged This signal emitted when database object is changed.
virtual void deleteFromCache(const QSharedPointer< QH::PKG::DBObject > &delObj)=0
deleteFromCache This method delete object from db cache, bat not from database.
void sigItemDeleted(const QH::DbAddress &obj)
sigItemDeleted This signal emitted when database object is deleted.
virtual bool updateCache(const QSharedPointer< QH::PKG::DBObject > &obj)=0
updateCache This method update already exits object on the cache, but not database.
virtual bool insertToCache(const QSharedPointer< QH::PKG::DBObject > &obj)=0
insertToCache This method insert object into cache, but not database. If Object exists in the cache t...
The DBObject class- main class for work with data base.
The SoftDelete class povide the soft delete functionality. All child classes of this class must be de...
The SqlDBWriter class. This class write and read objects from database (hard level)....
The iObjectProvider class is base interface for work with database objects. Using on database writers...
#define DEFAULT_UPDATE_INTERVAL
#define HEARTSHARED_EXPORT
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
uint qHash(NodeCoonectionStatus status)
qHash - Simple hash function of NodeCoonectionStatus
bool init()
init This method initialize default resources of the Heart Library.
SqlDBCasheWriteMode
The SqlDBCasheWriteMode enum contains list of available modes of write data into database.
@ Force
This mode writes all changes to the database as soon as they come to the cache.
@ On_New_Thread
This mode write a changes into another thread.
@ Default
General trust of the node or client.
CacheAction
The CacheAction enum contains types of database cache actions. The any database caches save all chang...
@ Update
Invoke the SqlDBWriter::updateObject method of a private database writer implementation.
@ Insert
Invoke the SqlDBWriter::insertObject method of a private database writer implementation.
@ Delete
Invoke the SqlDBWriter::deleteObject method of a private database writer implementation.