mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
dbeaver/dbeaver#10858 Retrieve rule manager from the completion context
This commit is contained in:
+6
@@ -25,6 +25,7 @@ import org.jkiss.dbeaver.model.sql.SQLSyntaxManager;
|
||||
import org.jkiss.dbeaver.model.sql.completion.SQLCompletionContext;
|
||||
import org.jkiss.dbeaver.model.sql.completion.SQLCompletionProposalBase;
|
||||
import org.jkiss.dbeaver.model.sql.completion.SQLCompletionRequest;
|
||||
import org.jkiss.dbeaver.model.sql.parser.SQLRuleManager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -58,6 +59,11 @@ public class WebSQLCompletionContext implements SQLCompletionContext {
|
||||
return sqlContext.getProcessor().getSyntaxManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SQLRuleManager getRuleManager() {
|
||||
return sqlContext.getProcessor().getRuleManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseFQNames() {
|
||||
return false;
|
||||
|
||||
+9
@@ -37,6 +37,7 @@ import org.jkiss.dbeaver.model.navigator.DBNNode;
|
||||
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
|
||||
import org.jkiss.dbeaver.model.sql.SQLQuery;
|
||||
import org.jkiss.dbeaver.model.sql.SQLSyntaxManager;
|
||||
import org.jkiss.dbeaver.model.sql.parser.SQLRuleManager;
|
||||
import org.jkiss.dbeaver.model.struct.*;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
@@ -56,6 +57,7 @@ public class WebSQLProcessor {
|
||||
private final WebSession webSession;
|
||||
private final WebConnectionInfo connection;
|
||||
private final SQLSyntaxManager syntaxManager;
|
||||
private final SQLRuleManager ruleManager;
|
||||
private final Map<String, WebSQLContextInfo> contexts = new LinkedHashMap<>();
|
||||
|
||||
private AtomicInteger contextId = new AtomicInteger();
|
||||
@@ -66,6 +68,9 @@ public class WebSQLProcessor {
|
||||
|
||||
syntaxManager = new SQLSyntaxManager();
|
||||
syntaxManager.init(connection.getDataSource());
|
||||
|
||||
ruleManager = new SQLRuleManager(syntaxManager);
|
||||
ruleManager.loadRules(connection.getDataSource(), false);
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
@@ -87,6 +92,10 @@ public class WebSQLProcessor {
|
||||
return syntaxManager;
|
||||
}
|
||||
|
||||
SQLRuleManager getRuleManager() {
|
||||
return ruleManager;
|
||||
}
|
||||
|
||||
DBCExecutionContext getExecutionContext() {
|
||||
return DBUtils.getDefaultContext(connection.getDataSource(), false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user