FastsqlSchemaTest.java 1013 字节
Newer Older
七锋 已提交
1 2 3 4 5 6 7
package com.alibaba.otter.canal.parse.inbound.mysql.tsdb;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.junit.Test;

温绍锦 已提交
8 9 10
import com.alibaba.druid.sql.repository.SchemaObject;
import com.alibaba.druid.sql.repository.SchemaRepository;
import com.alibaba.druid.util.JdbcConstants;
七锋 已提交
11 12 13 14 15 16 17 18 19 20

/**
 * @author agapple 2018年6月7日 下午5:36:13
 * @since 3.1.9
 */
public class FastsqlSchemaTest {

    @Test
    public void testSimple() throws FileNotFoundException, IOException {
        SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
A
agapple 已提交
21 22
        String sql = "create table quniya4(name varchar(255) null,value varchar(255) null,id int not null,constraint quniya4_pk primary key (id));"
                     + "alter table quniya4 modify id int not null first;";
七锋 已提交
23 24
        repository.console(sql);

A
agapple 已提交
25 26
        repository.setDefaultSchema("test");
        SchemaObject table = repository.findTable("quniya4");
七锋 已提交
27 28 29
        System.out.println(table.getStatement().toString());
    }
}