use of org.jooq.util.SchemaDefinition in project jOOQ by jOOQ.
the class DerbyDatabase method getSequences0.
@Override
protected List<SequenceDefinition> getSequences0() throws SQLException {
List<SequenceDefinition> result = new ArrayList<SequenceDefinition>();
for (Record record : create().select(Sysschemas.SCHEMANAME, Syssequences.SEQUENCENAME, Syssequences.SEQUENCEDATATYPE).from(SYSSEQUENCES).join(SYSSCHEMAS).on(Sysschemas.SCHEMAID.equal(Syssequences.SCHEMAID)).where(Sysschemas.SCHEMANAME.in(getInputSchemata())).orderBy(Sysschemas.SCHEMANAME, Syssequences.SEQUENCENAME).fetch()) {
SchemaDefinition schema = getSchema(record.get(Sysschemas.SCHEMANAME));
DataTypeDefinition type = new DefaultDataTypeDefinition(this, schema, record.get(Syssequences.SEQUENCEDATATYPE));
result.add(new DefaultSequenceDefinition(schema, record.get(Syssequences.SEQUENCENAME, String.class), type));
}
return result;
}
use of org.jooq.util.SchemaDefinition in project jOOQ by jOOQ.
the class DerbyDatabase method loadPrimaryKeys.
@Override
protected void loadPrimaryKeys(DefaultRelations relations) throws SQLException {
for (Record record : fetchKeys("P")) {
SchemaDefinition schema = getSchema(record.get(Sysschemas.SCHEMANAME));
String key = record.get(Sysconstraints.CONSTRAINTNAME);
String tableName = record.get(Systables.TABLENAME);
String descriptor = record.get(Sysconglomerates.DESCRIPTOR, String.class);
TableDefinition table = getTable(schema, tableName);
if (table != null) {
for (int index : decode(descriptor)) {
relations.addPrimaryKey(key, table.getColumn(index));
}
}
}
}
use of org.jooq.util.SchemaDefinition in project jOOQ by jOOQ.
the class DerbyDatabase method getTables0.
@Override
protected List<TableDefinition> getTables0() throws SQLException {
List<TableDefinition> result = new ArrayList<TableDefinition>();
for (Record record : create().select(Sysschemas.SCHEMANAME, Systables.TABLENAME, Systables.TABLEID).from(SYSTABLES).join(SYSSCHEMAS).on(Systables.SCHEMAID.equal(Sysschemas.SCHEMAID)).where(Sysschemas.SCHEMANAME.in(getInputSchemata())).orderBy(Sysschemas.SCHEMANAME, Systables.TABLENAME).fetch()) {
SchemaDefinition schema = getSchema(record.get(Sysschemas.SCHEMANAME));
String name = record.get(Systables.TABLENAME);
String id = record.get(Systables.TABLEID);
DerbyTableDefinition table = new DerbyTableDefinition(schema, name, id);
result.add(table);
}
return result;
}
use of org.jooq.util.SchemaDefinition in project jOOQ by jOOQ.
the class FirebirdDatabase method getSchemata0.
@Override
protected List<SchemaDefinition> getSchemata0() throws SQLException {
List<SchemaDefinition> result = new ArrayList<SchemaDefinition>();
result.add(new SchemaDefinition(this, "", ""));
return result;
}
use of org.jooq.util.SchemaDefinition in project jOOQ by jOOQ.
the class MySQLDatabase method loadPrimaryKeys.
@Override
protected void loadPrimaryKeys(DefaultRelations relations) throws SQLException {
for (Record record : fetchKeys(true)) {
SchemaDefinition schema = getSchema(record.get(Statistics.TABLE_SCHEMA));
String constraintName = record.get(Statistics.INDEX_NAME);
String tableName = record.get(Statistics.TABLE_NAME);
String columnName = record.get(Statistics.COLUMN_NAME);
String key = getKeyName(tableName, constraintName);
TableDefinition table = getTable(schema, tableName);
if (table != null) {
relations.addPrimaryKey(key, table.getColumn(columnName));
}
}
}
Aggregations