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 OracleAlterTableTest6 {
@Test
public void test_0() throws Exception {
String sql = //
"ALTER TABLE wl_service_record add ( service_type VARCHAR2(32) )";
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("wl_service_record")));
Assert.assertEquals(1, visitor.getColumns().size());
Assert.assertTrue(visitor.getColumns().contains(
new TableStat.Column("wl_service_record", "service_type")));
// Assert.assertTrue(visitor.getColumns().contains(new TableStat.Column("pivot_table", "YEAR")));
// Assert.assertTrue(visitor.getColumns().contains(new TableStat.Column("pivot_table", "order_mode")));
}
}