提交 d69b5792 authored 作者: Thomas Mueller's avatar Thomas Mueller

Pull request #118: Fix DbContextRule.PROCEDURE in BNF

上级 f36f879f
...@@ -2140,6 +2140,7 @@ value ...@@ -2140,6 +2140,7 @@ value
| ?[ int ] | ?[ int ]
| NEXT VALUE FOR sequenceName | NEXT VALUE FOR sequenceName
| function | function
| procedure
| { - | + } term | { - | + } term
| ( expression ) | ( expression )
| select | select
......
...@@ -131,6 +131,9 @@ class WebSession { ...@@ -131,6 +131,9 @@ class WebSession {
new DbContextRule(contents, DbContextRule.SCHEMA); new DbContextRule(contents, DbContextRule.SCHEMA);
DbContextRule columnAliasRule = DbContextRule columnAliasRule =
new DbContextRule(contents, DbContextRule.COLUMN_ALIAS); new DbContextRule(contents, DbContextRule.COLUMN_ALIAS);
DbContextRule procedure =
new DbContextRule(contents, DbContextRule.PROCEDURE);
newBnf.updateTopic("procedure", procedure);
newBnf.updateTopic("column_name", columnRule); newBnf.updateTopic("column_name", columnRule);
newBnf.updateTopic("new_table_alias", newAliasRule); newBnf.updateTopic("new_table_alias", newAliasRule);
newBnf.updateTopic("table_alias", aliasRule); newBnf.updateTopic("table_alias", aliasRule);
......
...@@ -136,13 +136,17 @@ public class TestBnf extends TestBase { ...@@ -136,13 +136,17 @@ public class TestBnf extends TestBase {
DbContextRule columnRule = new DbContextRule columnRule = new
DbContextRule(dbContents, DbContextRule.COLUMN); DbContextRule(dbContents, DbContextRule.COLUMN);
bnf.updateTopic("column_name", columnRule); bnf.updateTopic("column_name", columnRule);
bnf.updateTopic("expression", new bnf.updateTopic("procedure", new
DbContextRule(dbContents, DbContextRule.PROCEDURE)); DbContextRule(dbContents, DbContextRule.PROCEDURE));
bnf.linkStatements(); bnf.linkStatements();
// Test partial // Test partial
Map<String, String> tokens = bnf.getNextTokenList("SELECT CUSTOM_PR"); Map<String, String> tokens = bnf.getNextTokenList("SELECT CUSTOM_PR");
assertTrue(tokens.values().contains("INT")); assertTrue(tokens.values().contains("INT"));
// Test built-in function
tokens = bnf.getNextTokenList("SELECT LEAS");
assertTrue(tokens.values().contains("T"));
// Test parameters // Test parameters
tokens = bnf.getNextTokenList("SELECT CUSTOM_PRINT("); tokens = bnf.getNextTokenList("SELECT CUSTOM_PRINT(");
assertTrue(tokens.values().contains("STRING_FIELD")); assertTrue(tokens.values().contains("STRING_FIELD"));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论