From 1f2abd380eaacfc8c2fbbd455c28c1367915c217 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Mon, 7 Oct 2024 19:38:14 +0200 Subject: [PATCH] dbeaver/dbeaver#35475 Fix sql script execution --- .../src/io/cloudbeaver/service/sql/WebSQLProcessor.java | 4 ++-- .../src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLProcessor.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLProcessor.java index a58ab10961..05f3f4b219 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLProcessor.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLProcessor.java @@ -89,7 +89,7 @@ public class WebSQLProcessor implements WebSessionProvider { connection.getDataSource().getSQLDialect(), connection.getDataSourceContainer().getPreferenceStore()); ruleManager = new SQLRuleManager(syntaxManager); - ruleManager.loadRules(connection.getDataSource(), false); + ruleManager.loadRules(connection.getDataSourceContainer(), false); } void dispose() { @@ -192,7 +192,7 @@ public WebSQLExecuteInfo processQuery( document.set(sql); SQLParserContext parserContext = new SQLParserContext( - context.getDataSource(), + context.getDataSource().getContainer(), syntaxManager, ruleManager, document); diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java index 88fece2598..0adac481c8 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/impl/WebServiceSQL.java @@ -149,8 +149,9 @@ public WebSQLCompletionProposal[] getCompletionProposals( SQLScriptElement activeQuery; if (position != null) { + DBPDataSource source = sqlContext.getProcessor().getConnection().getDataSource(); SQLParserContext parserContext = new SQLParserContext( - sqlContext.getProcessor().getConnection().getDataSource(), + source != null ? source.getContainer() : null, completionContext.getSyntaxManager(), completionContext.getRuleManager(), document);