forked from alibaba/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support NAME keyword in Oracle XMLELEMENT function
- Loading branch information
1 parent
cf165de
commit 2dbcc9d
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
core/src/test/java/com/alibaba/druid/bvt/sql/oracle/OracleXmlelementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.alibaba.druid.bvt.sql.oracle; | ||
|
||
import com.alibaba.druid.sql.OracleTest; | ||
import com.alibaba.druid.sql.ast.SQLStatement; | ||
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; | ||
import com.alibaba.druid.sql.dialect.oracle.visitor.OracleSchemaStatVisitor; | ||
import org.junit.Assert; | ||
|
||
import java.util.List; | ||
|
||
public class OracleXmlelementTest extends OracleTest { | ||
public void testOracleXmlelement() { | ||
String sql = "SELECT /* NUSQL.TEST */ XMLELEMENT(NAME foo).getstringval() from dual"; | ||
|
||
OracleStatementParser parser = new OracleStatementParser(sql); | ||
List<SQLStatement> statementList = parser.parseStatementList(); | ||
SQLStatement statement = statementList.get(0); | ||
print(statementList); | ||
|
||
Assert.assertEquals(1, statementList.size()); | ||
|
||
OracleSchemaStatVisitor visitor = new OracleSchemaStatVisitor(); | ||
statement.accept(visitor); | ||
|
||
Assert.assertEquals(0, visitor.getTables().size()); | ||
Assert.assertEquals(0, visitor.getColumns().size()); | ||
} | ||
|
||
public void testOracleXmlelement_WithoutNameKeyword() { | ||
String sql = "SELECT /* NUSQL.TEST */ XMLELEMENT(foo).getstringval() from dual"; | ||
|
||
OracleStatementParser parser = new OracleStatementParser(sql); | ||
List<SQLStatement> statementList = parser.parseStatementList(); | ||
SQLStatement statement = statementList.get(0); | ||
print(statementList); | ||
|
||
Assert.assertEquals(1, statementList.size()); | ||
|
||
OracleSchemaStatVisitor visitor = new OracleSchemaStatVisitor(); | ||
statement.accept(visitor); | ||
|
||
Assert.assertEquals(0, visitor.getTables().size()); | ||
Assert.assertEquals(0, visitor.getColumns().size()); | ||
} | ||
} |