package com.alipay.zdal.test.ut.sqlparser.oracle; import java.util.List; import org.junit.Test; import junit.framework.Assert; import com.alipay.zdal.parser.sql.ast.SQLStatement; import com.alipay.zdal.parser.sql.dialect.oracle.parser.OracleStatementParser; import com.alipay.zdal.parser.sql.stat.TableStat; import com.alipay.zdal.parser.visitor.ZdalOracleSchemaStatVisitor; public class OracleAlterTableTest5 { @Test public void test_0() throws Exception { String sql = // "ALTER TABLE ht_task_flow_biz_product_2 modify ( ipr_biz_type_id DEFAULT 0 )"; OracleStatementParser parser = new OracleStatementParser(sql); List<SQLStatement> statementList = parser.parseStatementList(); SQLStatement statemen = statementList.get(0); Assert.assertEquals(1, statementList.size()); ZdalOracleSchemaStatVisitor visitor = new ZdalOracleSchemaStatVisitor(); statemen.accept(visitor); Assert.assertEquals(1, visitor.getTables().size()); Assert.assertTrue(visitor.getTables().containsKey( new TableStat.Name("ht_task_flow_biz_product_2"))); Assert.assertEquals(1, visitor.getColumns().size()); Assert.assertTrue(visitor.getColumns().contains( new TableStat.Column("ht_task_flow_biz_product_2", "ipr_biz_type_id"))); // Assert.assertTrue(visitor.getColumns().contains(new TableStat.Column("pivot_table", "YEAR"))); // Assert.assertTrue(visitor.getColumns().contains(new TableStat.Column("pivot_table", "order_mode"))); } }