diff options
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
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<QVariant>& args); + bool execInternal(const QHash<QString, QVariant>& 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<QVariant>& args) +{ + UNUSED(args); + return false; +} + +bool SqlQueryError::execInternal(const QHash<QString, QVariant>& args) +{ + UNUSED(args); + return false; +} |
