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/completionhelper.h | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'SQLiteStudio3/coreSQLiteStudio/completionhelper.h') diff --git a/SQLiteStudio3/coreSQLiteStudio/completionhelper.h b/SQLiteStudio3/coreSQLiteStudio/completionhelper.h index 8df1912..3cff8ec 100644 --- a/SQLiteStudio3/coreSQLiteStudio/completionhelper.h +++ b/SQLiteStudio3/coreSQLiteStudio/completionhelper.h @@ -64,7 +64,10 @@ class API_EXPORT CompletionHelper : public QObject DELETE_WHERE, CREATE_TABLE, CREATE_TRIGGER, - EXPR + EXPR, + INSERT_RETURNING, + UPDATE_RETURNING, + DELETE_RETURNING }; static void initFunctions(Db* db); @@ -125,6 +128,10 @@ class API_EXPORT CompletionHelper : public QObject void extractPreviousIdTokens(const TokenList& parsedTokens); void extractQueryAdditionalInfo(); void extractSelectAvailableColumnsAndTables(); + void extractInsertAvailableColumnsAndTables(); + void extractDeleteAvailableColumnsAndTables(); + void extractUpdateAvailableColumnsAndTables(); + void extractAvailableColumnsAndTables(const QString& database, const QString& table); bool extractSelectCore(); SqliteSelect::Core* extractSelectCore(SqliteQueryPtr query); void extractTableAliasMap(); @@ -135,6 +142,9 @@ class API_EXPORT CompletionHelper : public QObject bool isInDeleteWhere(); bool isInCreateTable(); bool isInCreateTrigger(); + bool isInUpdateReturning(); + bool isInDeleteReturning(); + bool isInInsertReturning(); bool isIn(SqliteQueryType queryType, const QString& tokenMapKey, const QString &prefixKeyword); bool isInExpr(); bool testQueryToken(int tokenPosition, Token::Type type, const QString& value, Qt::CaseSensitivity cs = Qt::CaseInsensitive); @@ -230,6 +240,20 @@ class API_EXPORT CompletionHelper : public QObject */ QSet selectAvailableTables; + /** + * @brief theFromAvailableColumns + * Available columns are columns that can be selected basing on what tables are mentioned in FROM clause + * of queries other than SELECT (so INSERT, UPDATE, DELETE), in their RETURNING clause. + */ + QList theFromAvailableColumns; + + /** + * @brief theFromAvailableTables + * Availble tables are tables mentioned in FROM clause of queries other than SELECT (so INSERT, UPDATE, DELETE), + * in their RETURNING clause. + */ + QSet theFromAvailableTables; + /** * @brief parentSelectCores * List of all parent select core objects in order: from direct parent, to the oldest parent. -- cgit v1.2.3