20class SQLiteDBCachePrivate:
public AsyncSqlDBWriter {
23 SQLiteDBCachePrivate():
25 thread()->setObjectName(
"DBCache");
30 QSqlDatabase initSqlDataBasse(
const QString &driverName,
31 const QString &name)
override;
33 bool initDb(
const QVariantMap ¶ms)
override;
35 friend class SQLiteDBCache;
38QSqlDatabase SQLiteDBCachePrivate::initSqlDataBasse(
const QString &driverName,
39 const QString &name) {
41 return QSqlDatabase::addDatabase(driverName,
46bool SQLiteDBCachePrivate::initDb(
const QVariantMap ¶ms) {
48 if (params.value(
"DBDriver").toString() !=
"QSQLITE") {
49 QuasarAppUtils::Params::log(
" the SQLiteDBCache class support only the QSQLITE driver.",
50 QuasarAppUtils::Error);
58SQLiteDBCache::SQLiteDBCache() {
59 _private =
new SQLiteDBCachePrivate();
62SQLiteDBCache::~SQLiteDBCache() {
66bool SQLiteDBCache::init(
const QVariantMap ¶ms) {
68 if (!ISqlDBCache::init(params)) {
72 return _private->initDb(params);
75void SQLiteDBCache::deleteFromCache(
const QSharedPointer<PKG::DBObject> &delObj) {
76 _private->deleteObject(delObj,
true);
79bool SQLiteDBCache::insertToCache(
const QSharedPointer<PKG::DBObject> &obj) {
80 return _private->insertObject(obj,
true);
83bool SQLiteDBCache::updateCache(
const QSharedPointer<PKG::DBObject> &obj) {
84 return _private->updateObject(obj,
true);
87QList<QSharedPointer<QH::PKG::DBObject>>
88SQLiteDBCache::getFromCache(
const PKG::DBObject *obj) {
90 QList<QSharedPointer<QH::PKG::DBObject>> list;
91 if (!_private->getAllObjects(*obj, list)) {
92 return QList<QSharedPointer<QH::PKG::DBObject>>{};
virtual bool initDb(const QString &initDbParams=DEFAULT_DB_PATH)
initDb This method is wraper of the initDb(const QVariantMap ¶ms) method. This implementation rea...
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...