use of org.openforis.collect.relational.print.RDBPrintJob.RdbDialect in project collect by openforis.
the class SQLRelationalSchemaCreator method getRdbDialect.
private RdbDialect getRdbDialect(CollectDSLContext dsl) {
SQLDialect dialect = dsl.getDialect();
RdbDialect rdbDialect;
switch(dialect) {
case SQLITE:
rdbDialect = RdbDialect.SQLITE;
break;
default:
rdbDialect = RdbDialect.STANDARD;
}
return rdbDialect;
}
use of org.openforis.collect.relational.print.RDBPrintJob.RdbDialect in project collect by openforis.
the class SQLRelationalSchemaCreator method createRelationalSchema.
@Override
public void createRelationalSchema(RelationalSchema schema, Connection conn) {
CollectDSLContext dsl = new CollectDSLContext(conn);
RdbDialect rdbDialect = getRdbDialect(dsl);
Writer writer = new StringWriter();
SqlSchemaWriter schemaWriter = new SqlSchemaWriter(writer, schema, rdbDialect);
try {
schemaWriter.write();
String sql = writer.toString();
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
} catch (Throwable e) {
throw new RuntimeException(String.format("Error generating schema on db for rdb schema %s", schema.getName()), e);
}
}
Aggregations