39 SqlDBWriter(QThread *thread, QObject* ptr =
nullptr);
58 virtual bool initDb(
const QVariantMap ¶ms);
64 virtual bool isValid()
const;
67 QList<QSharedPointer<PKG::DBObject>> &result)
override;
68 bool updateObject(
const QSharedPointer<PKG::DBObject> &ptr,
bool wait =
false)
override;
69 bool deleteObject(
const QSharedPointer<PKG::DBObject> &ptr,
bool wait =
false)
override;
70 bool insertObject(
const QSharedPointer<PKG::DBObject> &ptr,
bool wait =
false,
71 const QWeakPointer<unsigned int>& autoincrementIdResult = {})
override;
72 bool replaceObject(
const QSharedPointer<PKG::DBObject> &ptr,
bool wait =
false)
override;
74 void setSQLSources(
const QStringList &list)
override;
75 bool doQuery(
const QString& query,
const QVariantMap& bindValues = {},
bool wait =
false, QSqlQuery *result =
nullptr)
const override;
76 bool doSql(
const QString &sqlFile,
bool wait)
const override;
83 QString databaseLocation()
const;
93 virtual bool updateQuery(
const QSharedPointer<QH::PKG::DBObject> &ptr)
const;
102 QList<QSharedPointer<QH::PKG::DBObject>> &result);
109 virtual bool deleteQuery(
const QSharedPointer<QH::PKG::DBObject> &deleteObject)
const;
118 virtual bool insertQuery(
const QSharedPointer<QH::PKG::DBObject>& insertObject,
119 const QWeakPointer<unsigned int>& autoIncrementID = {})
const;
127 virtual bool replaceQuery(
const QSharedPointer<QH::PKG::DBObject>& insertObject)
const;
162 virtual QVariantMap getInitParams(
const QString& initFile)
const;
180 virtual QVariantMap defaultInitPararm()
const;
190 virtual QSqlDatabase initSqlDataBasse(
const QString &driverName,
191 const QString &name);
204 const QSqlDatabase* db()
const;
216 bool workWithQuery(QSqlQuery &q,
218 const std::function<
bool()>& cb)
const;
220 bool exec(QSqlQuery *sq,
const QString &sqlFile)
const;
227 bool initDbPrivate(
const QVariantMap ¶ms);
235 bool doQueryPrivate(
const QString& query,
236 const QVariantMap &bindValues,
237 QSqlQuery *result)
const;
239 bool doSqlPrivate(
const QString &sqlFile)
const;
241 bool initSuccessful =
false;
243 QStringList _SQLSources;
245 QSqlDatabase *_db =
nullptr;