Search in sources :

Example 11 with DbColVarchar

use of ch.ehi.sqlgen.repository.DbColVarchar in project ili2db by claeis.

the class TransferFromIli method addModelsTable.

public static void addModelsTable(DbSchema schema, Settings config) {
    DbTable tab = new DbTable();
    tab.setName(new DbTableName(schema.getName(), DbNames.MODELS_TAB));
    DbColVarchar fileCol = new DbColVarchar();
    fileCol.setName(DbNames.MODELS_TAB_FILE_COL);
    fileCol.setNotNull(true);
    fileCol.setSize(250);
    tab.addColumn(fileCol);
    DbColVarchar iliversionCol = new DbColVarchar();
    iliversionCol.setName(DbNames.MODELS_TAB_ILIVERSION_COL);
    iliversionCol.setNotNull(true);
    iliversionCol.setSize(3);
    tab.addColumn(iliversionCol);
    DbColVarchar importsCol = new DbColVarchar();
    importsCol.setName(DbNames.MODELS_TAB_MODELNAME_COL);
    importsCol.setNotNull(true);
    int modelNameColSize = DbColVarchar.UNLIMITED;
    String modelNameColSizeStr = config.getValue(Config.MODELS_TAB_MODELNAME_COLSIZE);
    if (modelNameColSizeStr != null) {
        try {
            modelNameColSize = Integer.parseInt(modelNameColSizeStr);
        } catch (NumberFormatException e) {
        }
    }
    importsCol.setSize(modelNameColSize);
    tab.addColumn(importsCol);
    DbColVarchar contentCol = new DbColVarchar();
    contentCol.setName(DbNames.MODELS_TAB_CONTENT_COL);
    contentCol.setNotNull(true);
    contentCol.setSize(DbColVarchar.UNLIMITED);
    tab.addColumn(contentCol);
    DbColDateTime importDateCol = new DbColDateTime();
    importDateCol.setName(DbNames.MODELS_TAB_IMPORTDATE_COL);
    importDateCol.setNotNull(true);
    tab.addColumn(importDateCol);
    DbIndex pk = new DbIndex();
    pk.setPrimary(true);
    pk.addAttr(importsCol);
    pk.addAttr(iliversionCol);
    tab.addIndex(pk);
    schema.addTable(tab);
}
Also used : DbColVarchar(ch.ehi.sqlgen.repository.DbColVarchar) DbColDateTime(ch.ehi.sqlgen.repository.DbColDateTime) DbTableName(ch.ehi.sqlgen.repository.DbTableName) DbIndex(ch.ehi.sqlgen.repository.DbIndex) DbTable(ch.ehi.sqlgen.repository.DbTable)

Example 12 with DbColVarchar

use of ch.ehi.sqlgen.repository.DbColVarchar in project ili2db by claeis.

the class AbstractRecordConverter method addStdCol.

public static void addStdCol(DbTable table) {
    DbColumn dbCol = new DbColDateTime();
    dbCol.setName(DbNames.T_LAST_CHANGE_COL);
    dbCol.setNotNull(true);
    table.addColumn(dbCol);
    dbCol = new DbColDateTime();
    dbCol.setName(DbNames.T_CREATE_DATE_COL);
    dbCol.setNotNull(true);
    table.addColumn(dbCol);
    DbColVarchar dbColUsr = new DbColVarchar();
    dbColUsr.setName(DbNames.T_USER_COL);
    dbColUsr.setNotNull(true);
    dbColUsr.setSize(40);
    table.addColumn(dbColUsr);
}
Also used : DbColumn(ch.ehi.sqlgen.repository.DbColumn) DbColVarchar(ch.ehi.sqlgen.repository.DbColVarchar) DbColDateTime(ch.ehi.sqlgen.repository.DbColDateTime)

Example 13 with DbColVarchar

use of ch.ehi.sqlgen.repository.DbColVarchar in project ili2db by claeis.

the class AbstractRecordConverter method addIliTidCol.

public void addIliTidCol(DbTable dbTable, Domain oidDomain) {
    if (isUuidOid(td, oidDomain)) {
        DbColUuid dbColIliTid = new DbColUuid();
        dbColIliTid.setName(DbNames.T_ILI_TID_COL);
        // CREATE EXTENSION "uuid-ossp";
        dbColIliTid.setDefaultValue(uuid_default_value);
        dbTable.addColumn(dbColIliTid);
    } else {
        DbColVarchar dbColIliTid = new DbColVarchar();
        dbColIliTid.setName(DbNames.T_ILI_TID_COL);
        dbColIliTid.setSize(200);
        dbTable.addColumn(dbColIliTid);
    }
}
Also used : DbColVarchar(ch.ehi.sqlgen.repository.DbColVarchar) DbColUuid(ch.ehi.sqlgen.repository.DbColUuid)

Aggregations

DbColVarchar (ch.ehi.sqlgen.repository.DbColVarchar)13 DbTable (ch.ehi.sqlgen.repository.DbTable)7 DbTableName (ch.ehi.sqlgen.repository.DbTableName)7 DbColId (ch.ehi.sqlgen.repository.DbColId)5 DbColBoolean (ch.ehi.sqlgen.repository.DbColBoolean)4 DbColDateTime (ch.ehi.sqlgen.repository.DbColDateTime)4 AttributeDef (ch.interlis.ili2c.metamodel.AttributeDef)4 EnumerationType (ch.interlis.ili2c.metamodel.EnumerationType)4 SurfaceOrAreaType (ch.interlis.ili2c.metamodel.SurfaceOrAreaType)4 SurfaceType (ch.interlis.ili2c.metamodel.SurfaceType)4 DbColGeometry (ch.ehi.sqlgen.repository.DbColGeometry)3 DbColNumber (ch.ehi.sqlgen.repository.DbColNumber)3 DbColUuid (ch.ehi.sqlgen.repository.DbColUuid)3 DbColumn (ch.ehi.sqlgen.repository.DbColumn)3 BasketType (ch.interlis.ili2c.metamodel.BasketType)3 BlackboxType (ch.interlis.ili2c.metamodel.BlackboxType)3 NumericType (ch.interlis.ili2c.metamodel.NumericType)3 TextType (ch.interlis.ili2c.metamodel.TextType)3 Viewable (ch.interlis.ili2c.metamodel.Viewable)3 Iterator (java.util.Iterator)3