aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:31:18 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:31:18 -0400
commit4de57f628bc74f00ba1885e91c84ea07c5405d8f (patch)
tree5d91900751e826d491ff1b2ebc571a787e84f864 /SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp
parent74d881cefa9097e58e129e37b9c44d680d8c7dfe (diff)
parent3565aad630864ecdbe53fdaa501ea708555b3c7c (diff)
Update upstream source from tag 'upstream/3.4.4+dfsg'
Update to upstream version '3.4.4+dfsg' with Debian dir 482614bd23f0ef52dabc9803477204ad88e917ed
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp81
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;
+}