aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-01-16 01:57:37 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2025-01-16 01:57:37 -0500
commit81a21e6ce040e7740de86340c8ea4dba30e69bc3 (patch)
tree95fc1741b907d5ba6d029a42d80092cb7c056c5e /SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
parent3565aad630864ecdbe53fdaa501ea708555b3c7c (diff)
New upstream version 3.4.13+dfsg.upstream/3.4.13+dfsgupstream
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
index cd6e2a5..1ff79db 100644
--- a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
@@ -11,6 +11,9 @@ CompletionComparer::CompletionComparer(CompletionHelper *helper)
bool CompletionComparer::operator ()(const ExpectedTokenPtr& token1, const ExpectedTokenPtr& token2)
{
+ if (token2->type == ExpectedToken::OTHER || token1->type == ExpectedToken::OTHER)
+ qDebug() << "";
+
if ((token1->priority > 0 || token2->priority > 0) && token1->priority != token2->priority)
return token1->priority > token2->priority;
@@ -116,6 +119,8 @@ bool CompletionComparer::compareColumns(const ExpectedTokenPtr& token1, const Ex
case CompletionHelper::Context::UPDATE_WHERE:
result = compareColumnsForUpdateCol(token1, token2, &ok);
break;
+ case CompletionHelper::Context::INSERT_COLUMNS:
+ result = compareColumnsForInsertCol(token1, token2, &ok);
case CompletionHelper::Context::DELETE_WHERE:
result = compareColumnsForDeleteCol(token1, token2, &ok);
break;
@@ -192,7 +197,7 @@ bool CompletionComparer::compareColumnsForUpdateCol(const ExpectedTokenPtr &toke
if (token1->contextInfo == token2->contextInfo)
return compareValues(token1->value, token2->value);
- return compareByContext(token1->contextInfo, token2->contextInfo, contextTables);
+ return compareByContext(token1->contextInfo, token2->contextInfo, contextTables, true);
}
bool CompletionComparer::compareColumnsForDeleteCol(const ExpectedTokenPtr &token1, const ExpectedTokenPtr &token2, bool *result)
@@ -201,7 +206,16 @@ bool CompletionComparer::compareColumnsForDeleteCol(const ExpectedTokenPtr &toke
if (token1->contextInfo == token2->contextInfo)
return compareValues(token1->value, token2->value);
- return compareByContext(token1->contextInfo, token2->contextInfo, contextTables);
+ return compareByContext(token1->contextInfo, token2->contextInfo, contextTables, true);
+}
+
+bool CompletionComparer::compareColumnsForInsertCol(const ExpectedTokenPtr &token1, const ExpectedTokenPtr &token2, bool *result)
+{
+ *result = true;
+ if (token1->contextInfo == token2->contextInfo)
+ return compareValues(token1->value, token2->value);
+
+ return compareByContext(token1->contextInfo, token2->contextInfo, contextTables, true);
}
bool CompletionComparer::compareColumnsForCreateTable(const ExpectedTokenPtr& token1, const ExpectedTokenPtr& token2, bool* result)
@@ -304,7 +318,7 @@ bool CompletionComparer::compareValues(const ExpectedTokenPtr &token1, const Exp
bool CompletionComparer::compareValues(const QString &token1, const QString &token2, bool handleSystemNames)
{
- //qDebug() << "comparing" << token1 << "and" << token2 << "=" << token1.compare(token2, Qt::CaseInsensitive);
+ // qDebug() << "comparing" << token1 << "and" << token2 << "=" << token1.compare(token2, Qt::CaseInsensitive);
if (handleSystemNames)
{
bool firstIsSystem = token1.toLower().startsWith("sqlite_");