From 3565aad630864ecdbe53fdaa501ea708555b3c7c Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sun, 30 Apr 2023 18:30:36 -0400 Subject: New upstream version 3.4.4+dfsg. --- SQLiteStudio3/coreSQLiteStudio/sqlfileexecutor.h | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 SQLiteStudio3/coreSQLiteStudio/sqlfileexecutor.h (limited to 'SQLiteStudio3/coreSQLiteStudio/sqlfileexecutor.h') diff --git a/SQLiteStudio3/coreSQLiteStudio/sqlfileexecutor.h b/SQLiteStudio3/coreSQLiteStudio/sqlfileexecutor.h new file mode 100644 index 0000000..fbca301 --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/sqlfileexecutor.h @@ -0,0 +1,43 @@ +#ifndef SQLFILEEXECUTOR_H +#define SQLFILEEXECUTOR_H + +#include "coreSQLiteStudio_global.h" +#include +#include + +class Db; + +class API_EXPORT SqlFileExecutor : public QObject +{ + Q_OBJECT + + public: + explicit SqlFileExecutor(QObject *parent = nullptr); + void execSqlFromFile(Db* db, const QString& filePath, bool ignoreErrors, QString codec, bool async = true); + bool isExecuting() const; + + private: + bool execQueryFromFile(Db* db, const QString& sql); + void execInThread(); + void handleExecutionResults(Db* db, int executed, int attemptedExecutions, bool ok, bool ignoreErrors, int millis); + QList> executeFromStream(QTextStream& stream, int& executed, int& attemptedExecutions, bool& ok, qint64 fileSize); + bool shouldSkipQuery(const QString& sql); + + QAtomicInt executionInProgress = 0; + Db* db = nullptr; + bool fkWasEnabled = true; + bool ignoreErrors = false; + QString codec; + QString filePath; + + public slots: + void stopExecution(); + + signals: + void schemaNeedsRefreshing(Db* db); + void updateProgress(int value); + void execEnded(); + void execErrors(const QList>& errors, bool rolledBack); +}; + +#endif // SQLFILEEXECUTOR_H -- cgit v1.2.3