aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp
index faf8c8e..abe2578 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp
@@ -1,6 +1,7 @@
#include "statementtokenbuilder.h"
#include "parser/ast/sqlitestatement.h"
#include "common/utils_sql.h"
+#include "common/global.h"
#include <QVariant>
StatementTokenBuilder& StatementTokenBuilder::withKeyword(const QString& value)
@@ -23,7 +24,7 @@ StatementTokenBuilder&StatementTokenBuilder::withStringPossiblyOther(const QStri
if (value.contains("\""))
return withOther(wrapObjIfNeeded(value));
else
- return withOther(wrapObjName(value, NameWrapper::DOUBLE_QUOTE));
+ return withOther(wrapObjName(value, NameWrapper::DOUBLE_QUOTE), false);
}
StatementTokenBuilder& StatementTokenBuilder::withOtherList(const QList<QString>& value, const QString& separator)
@@ -91,7 +92,7 @@ StatementTokenBuilder& StatementTokenBuilder::withBlob(const QString& value)
StatementTokenBuilder& StatementTokenBuilder::withString(const QString& value)
{
- return with(Token::STRING, wrapStringIfNeeded(value));
+ return with(Token::STRING, wrapString(value));
}
StatementTokenBuilder& StatementTokenBuilder::withConflict(SqliteConflictAlgo onConflict)
@@ -145,6 +146,13 @@ StatementTokenBuilder& StatementTokenBuilder::withLiteralValue(const QVariant& v
return *this;
}
+ if (value.userType() == QVariant::ByteArray)
+ {
+ static_qstring(blobLiteral, "X'%1'");
+ withBlob(blobLiteral.arg(QString::fromLatin1(value.toByteArray().toHex())));
+ return *this;
+ }
+
bool ok;
if (value.userType() == QVariant::Double)
{
@@ -163,14 +171,7 @@ StatementTokenBuilder& StatementTokenBuilder::withLiteralValue(const QVariant& v
return *this;
}
- QString str = value.toString();
- if (str.startsWith("x'", Qt::CaseInsensitive) && str.endsWith("'"))
- {
- withBlob(str);
- return *this;
- }
-
- withString(str);
+ withString(value.toString());
return *this;
}