You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/04/22 05:11:46 UTC
[shardingsphere] branch master updated: Update parser doc (#25269)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 266d3064c3d Update parser doc (#25269)
266d3064c3d is described below
commit 266d3064c3d2ee1e972f39c431111891a9bdb808
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Apr 22 13:11:39 2023 +0800
Update parser doc (#25269)
---
.../user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.cn.md | 3 ++-
.../user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.en.md | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.cn.md
index b00aee43369..5a667eff1d1 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.cn.md
@@ -4,6 +4,7 @@ weight = 7
+++
## 背景信息
+
SQL 是使用者与数据库交流的标准语言。 SQL 解析引擎负责将 SQL 字符串解析为抽象语法树,供 Apache ShardingSphere 理解并实现其增量功能。
目前支持 MySQL, PostgreSQL, SQLServer, Oracle, openGauss 以及符合 SQL92 规范的 SQL 方言。 由于 SQL 语法的复杂性,目前仍然存在少量不支持的 SQL。
通过 Java API 形式使用 SQL 解析,可以方便得集成进入各种系统,灵活定制用户需求。
@@ -43,7 +44,7 @@ SQL 是使用者与数据库交流的标准语言。 SQL 解析引擎负责将 S
CacheOption cacheOption = new CacheOption(128, 1024L);
SQLParserEngine parserEngine = new SQLParserEngine("MySQL", cacheOption);
ParseASTNode parseASTNode = parserEngine.parse("SELECT t.id, t.name, t.age FROM table1 AS t ORDER BY t.id DESC;", false);
-SQLVisitorEngine visitorEngine = new SQLVisitorEngine("MySQL", "STATEMENT", false, new Properties());
+SQLStatementVisitorEngine visitorEngine = new SQLStatementVisitorEngine("MySQL", false);
MySQLStatement sqlStatement = visitorEngine.visit(parseASTNode);
System.out.println(sqlStatement.toString());
```
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.en.md
index dab786ed193..d23b7bb7fe2 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/sql-parser.en.md
@@ -44,7 +44,7 @@ Attributes:
CacheOption cacheOption = new CacheOption(128, 1024L);
SQLParserEngine parserEngine = new SQLParserEngine("MySQL", cacheOption);
ParseASTNode parseASTNode = parserEngine.parse("SELECT t.id, t.name, t.age FROM table1 AS t ORDER BY t.id DESC;", false);
-SQLVisitorEngine visitorEngine = new SQLVisitorEngine("MySQL", "STATEMENT", false, new Properties());
+SQLStatementVisitorEngine visitorEngine = new SQLStatementVisitorEngine("MySQL", false);
MySQLStatement sqlStatement = visitorEngine.visit(parseASTNode);
System.out.println(sqlStatement.toString());
```