mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved odps support
This commit is contained in:
@@ -18,6 +18,7 @@ public class OdpsCreateTableTest2 extends TestCase {
|
||||
parser.match(Token.EOF);
|
||||
String output = SQLUtils.toOdpsString(stmt);
|
||||
Assert.assertEquals("CREATE TABLE sale_detail"
|
||||
+ "\nAS"
|
||||
+ "\nSELECT *" //
|
||||
+ "\nFROM dual", output);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alibaba.druid.bvt.sql.odps;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OdpsFormatCommentTest23 extends TestCase {
|
||||
public void test_drop_table() throws Exception {
|
||||
String sql = "-- xxx"
|
||||
+ "\n -- yyy"
|
||||
+ "\ndrop table if exists mytables;";
|
||||
Assert.assertEquals("-- xxx"
|
||||
+ "\n-- yyy"
|
||||
+ "\nDROP TABLE IF EXISTS mytables;", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alibaba.druid.bvt.sql.odps;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OdpsFormatCommentTest24 extends TestCase {
|
||||
public void test_drop_view() throws Exception {
|
||||
String sql = "-- xxx"
|
||||
+ "\n -- yyy"
|
||||
+ "\ndrop view if exists mytables;";
|
||||
Assert.assertEquals("-- xxx"
|
||||
+ "\n-- yyy"
|
||||
+ "\nDROP VIEW IF EXISTS mytables;", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alibaba.druid.bvt.sql.odps;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OdpsFormatCommentTest25 extends TestCase {
|
||||
public void test_drop_function() throws Exception {
|
||||
String sql = "-- xxx"
|
||||
+ "\n -- yyy"
|
||||
+ "\ndrop function if exists mytables;";
|
||||
Assert.assertEquals("-- xxx"
|
||||
+ "\n-- yyy"
|
||||
+ "\nDROP FUNCTION IF EXISTS mytables;", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.druid.bvt.sql.odps;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OdpsFormatCommentTest26 extends TestCase {
|
||||
public void test_drop_function() throws Exception {
|
||||
String sql = "create table t as select * from dual;";
|
||||
Assert.assertEquals("CREATE TABLE t"
|
||||
+ "\nAS"
|
||||
+ "\nSELECT *"
|
||||
+ "\nFROM dual;", SQLUtils.formatOdps(sql));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user