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/db/sqlquery.cpp | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 'SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp') diff --git a/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp b/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp index bef3ed8..0880344 100644 --- a/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp @@ -1,6 +1,7 @@ #include "sqlquery.h" #include "db/sqlerrorcodes.h" #include "common/utils_sql.h" +#include "common/unused.h" SqlQuery::~SqlQuery() { @@ -141,3 +142,83 @@ QString RowIdConditionBuilder::build() { return conditions.join(" AND "); } + +/********************** SqlQueryError ************************/ + +class API_EXPORT SqlQueryError : public SqlQuery +{ + public: + SqlQueryError(const QString& errorText, int errorCode); + virtual ~SqlQueryError(); + + QString getErrorText(); + int getErrorCode(); + QStringList getColumnNames(); + int columnCount(); + + protected: + SqlResultsRowPtr nextInternal(); + bool hasNextInternal(); + bool execInternal(const QList& args); + bool execInternal(const QHash& args); + + private: + QString errorText; + int errorCode = 0; +}; + +SqlQueryPtr SqlQuery::error(const QString& errorText, int errorCode) +{ + return SqlQueryPtr(new SqlQueryError(errorText, errorCode)); +} + +SqlQueryError::SqlQueryError(const QString& errorText, int errorCode) : + errorText(errorText), errorCode(errorCode) +{ +} + +SqlQueryError::~SqlQueryError() +{ +} + +QString SqlQueryError::getErrorText() +{ + return errorText; +} + +int SqlQueryError::getErrorCode() +{ + return errorCode; +} + +QStringList SqlQueryError::getColumnNames() +{ + return QStringList(); +} + +int SqlQueryError::columnCount() +{ + return 0; +} + +SqlResultsRowPtr SqlQueryError::nextInternal() +{ + return SqlResultsRowPtr(); +} + +bool SqlQueryError::hasNextInternal() +{ + return false; +} + +bool SqlQueryError::execInternal(const QList& args) +{ + UNUSED(args); + return false; +} + +bool SqlQueryError::execInternal(const QHash& args) +{ + UNUSED(args); + return false; +} -- cgit v1.2.3