Search in sources :

Example 36 with Table

use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.

the class TableTest method allowNullModel.

private static Table allowNullModel() {
    // Allow Null
    Table t = new Table("testTable");
    t.column("b1").BOOLEAN();
    t.column("d2").DOUBLE();
    t.column("f3").FLOAT(5);
    t.column("i4").INTEGER();
    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);
    return t;
}
Also used : Table(com.github.drinkjava2.jdialects.model.Table)

Example 37 with Table

use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.

the class TableTest method autoGeneratorModel2.

private static Table autoGeneratorModel2() {
    // autoGenerator
    Table t = new Table("testTable2");
    t.addTableGenerator("tbgen7", "tb1", "pkcol4", "valcol", "pkval5", 1, 10);
    t.column("i1").INTEGER().pkey().autoGenerator();
    t.column("i2").INTEGER().autoGenerator();
    t.column("i3").INTEGER().autoGenerator();
    return t;
}
Also used : Table(com.github.drinkjava2.jdialects.model.Table)

Example 38 with Table

use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.

the class TableTest method testNotNullModel.

private static Table testNotNullModel() {
    // Not Null
    Table t = new Table("testTable");
    t.column("b1").BOOLEAN().notNull();
    t.column("d2").DOUBLE().notNull();
    t.column("f3").FLOAT(5).notNull();
    t.column("i4").INTEGER().notNull();
    t.column("l5").LONG().notNull();
    t.column("s6").SHORT().notNull();
    t.column("b7").BIGDECIMAL(10, 2).notNull();
    t.column("s8").STRING(20).notNull();
    t.column("d9").DATE().notNull();
    t.column("t10").TIME().notNull();
    t.column("t11").TIMESTAMP().notNull();
    t.column("v12").VARCHAR(300).notNull();
    return t;
}
Also used : Table(com.github.drinkjava2.jdialects.model.Table)

Example 39 with Table

use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.

the class TableTest method tableCheckModel.

private static Table tableCheckModel() {
    // table check
    Table t = new Table("testTable");
    t.check("s2>10");
    t.column("s1").STRING(20).unique().notNull();
    t.column("s2").STRING(20);
    return t;
}
Also used : Table(com.github.drinkjava2.jdialects.model.Table)

Example 40 with Table

use of com.github.drinkjava2.jdialects.model.Table in project jDialects by drinkjava2.

the class TableTest method SequenceModel.

private static Table SequenceModel() {
    // Sequence
    Table t = new Table("testTable");
    t.addSequence("seq1", "seq_1", 1, 1);
    t.addSequence("seq2", "seq_2", 1, 1);
    t.column("i1").INTEGER().pkey().sequence("seq1");
    t.column("i2").INTEGER().pkey().sequence("seq2");
    return t;
}
Also used : Table(com.github.drinkjava2.jdialects.model.Table)

Aggregations

Table (com.github.drinkjava2.jdialects.model.Table)18 Test (org.junit.Test)10 TableModel (com.github.drinkjava2.jdialects.model.TableModel)9 ColumnModel (com.github.drinkjava2.jdialects.model.ColumnModel)8 AutoIdGenerator (com.github.drinkjava2.jdialects.id.AutoIdGenerator)7 IdGenerator (com.github.drinkjava2.jdialects.id.IdGenerator)7 TableIdGenerator (com.github.drinkjava2.jdialects.id.TableIdGenerator)6 FKeyModel (com.github.drinkjava2.jdialects.model.FKeyModel)6 SequenceIdGenerator (com.github.drinkjava2.jdialects.id.SequenceIdGenerator)4 ArrayList (java.util.ArrayList)4 Dialect (com.github.drinkjava2.jdialects.Dialect)3 FKeyConstraint (com.github.drinkjava2.jdialects.model.FKeyConstraint)3 UniqueModel (com.github.drinkjava2.jdialects.model.UniqueModel)3 DB2400Dialect (com.github.drinkjava2.jdialects.Dialect.DB2400Dialect)2 DB2Dialect (com.github.drinkjava2.jdialects.Dialect.DB2Dialect)2 DerbyDialect (com.github.drinkjava2.jdialects.Dialect.DerbyDialect)2 DerbyTenFiveDialect (com.github.drinkjava2.jdialects.Dialect.DerbyTenFiveDialect)2 DerbyTenSevenDialect (com.github.drinkjava2.jdialects.Dialect.DerbyTenSevenDialect)2 DerbyTenSixDialect (com.github.drinkjava2.jdialects.Dialect.DerbyTenSixDialect)2 H2Dialect (com.github.drinkjava2.jdialects.Dialect.H2Dialect)2