forked from alibaba/druid
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
优化解析union后的括号逻辑 alibaba#5241 单测还没改完
- Loading branch information
Showing
13 changed files
with
126 additions
and
59 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
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
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
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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
core/src/test/java/com/alibaba/druid/bvt/sql/oracle/issues/Issue5241.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,49 @@ | ||
package com.alibaba.druid.bvt.sql.oracle.issues; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.SQLParseAssertUtil; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* 验证 Oracle union sql的问题 | ||
* | ||
* @author lizongbo | ||
* @see <a href="https://github.com/alibaba/druid/issues/5241">Issue来源</a> | ||
*/ | ||
public class Issue5241 { | ||
|
||
@Test | ||
public void test_parse_union() throws Exception { | ||
for (DbType dbType : new DbType[]{ | ||
//DbType.mysql, | ||
//DbType.oracle, | ||
DbType.oscar, | ||
}) { | ||
for (String sql : new String[]{ | ||
"select count(*)" + | ||
"from (" + | ||
" (select id1111 from tb_user111 where id in(1,2) order by id)" + | ||
" union" + | ||
" (select id2222 from tb_user222 where id=4 )" + | ||
" union" + | ||
" (select id3333 from tb_user333 where id=5 )" + | ||
"" + | ||
") t", | ||
"select *\n" + | ||
"from (\n" + | ||
" (select * from tb_user6666 where id in(1,2) order by id )\n" + | ||
" union (select id from tb_user7777 where id=5 order by id)\n" + | ||
" \n" + | ||
" union\n" + | ||
" select * from tb_user8888 where id=4 order by id desc\n" + | ||
"\n" + | ||
") t;", | ||
}) { | ||
SQLParseAssertUtil.assertParseSql(sql, dbType); | ||
} | ||
} | ||
} | ||
} |
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
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
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
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