use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class TableTest method CommentModel.
private static Table CommentModel() {
// Comment
Table t = new Table("testTable").comment("table_comment");
t.column("s1").INTEGER().unique().notNull().identity().pkey();
t.column("s2").LONG().comment("column_comment1");
t.column("s3").BIGINT().comment("column_comment2");
return t;
}
use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class TableTest method printAllDialectsDDLs.
private static void printAllDialectsDDLs(Table... tables) {
Dialect[] diaList = Dialect.values();
for (Dialect dialect : diaList) {
System.out.println("======" + dialect + "=====");
try {
String[] ddl = dialect.toCreateDDL(tables);
printDDLs(ddl);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Exception found: " + e.getMessage());
}
}
}
use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class TableTest method testANormalModel.
@Test
public void testANormalModel() {
// A normal setting
Table t = new Table("testTable");
t.column("b1").BOOLEAN();
t.column("d2").DOUBLE();
t.column("f3").FLOAT(5);
t.column("i4").INTEGER().pkey();
t.column("l5").LONG();
t.column("s6").SHORT();
t.column("b7").BIGDECIMAL(10, 2);
t.column("s8").STRING(20);
t.column("d9").DATE();
t.column("t10").TIME();
t.column("t11").TIMESTAMP();
t.column("v12").VARCHAR(300);
printAllDialectsDDLs(t);
}
use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class TableTest method testNoPkey.
@Test
public void testNoPkey() {
// Test no Prime Key
// append() is a linked method
Table table = new Table("tb").append(new Column("field1").INTEGER()).append(new Column("field2").LONG());
printAllDialectsDDLs(table);
}
use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.
the class DDLTest method testNoPkey.
@Test
public void testNoPkey() {
// Test no Prime Key
// append() is a linked method
TableModel t = new TableModel("aa");
t.addColumn(new ColumnModel("aaaa"));
TableModel table = new TableModel("tb").addColumn(new ColumnModel("field1").INTEGER()).addColumn(new ColumnModel("field2").LONG());
printAllDialectsDDLs(table);
testOnCurrentRealDatabase(table);
}
Aggregations