use of org.jooq.util.mysql.mysql.enums.ProcType in project jOOQ by jOOQ.
the class MySQLDatabase method getRoutines0.
@Override
protected List<RoutineDefinition> getRoutines0() throws SQLException {
List<RoutineDefinition> result = new ArrayList<RoutineDefinition>();
try {
create(true).fetchCount(PROC);
} catch (DataAccessException e) {
log.warn("Table unavailable", "The `mysql`.`proc` table is unavailable. Stored procedures cannot be loaded. Check if you have sufficient grants");
return result;
}
Result<Record6<String, String, String, byte[], byte[], ProcType>> records = create().select(Proc.DB, Proc.NAME, Proc.COMMENT, Proc.PARAM_LIST, Proc.RETURNS, Proc.TYPE).from(PROC).where(DB.in(getInputSchemata())).orderBy(DB, Proc.NAME).fetch();
Map<Record, Result<Record6<String, String, String, byte[], byte[], ProcType>>> groups = records.intoGroups(new Field[] { Proc.DB, Proc.NAME });
// procedures and functions with the same signature.
for (Entry<Record, Result<Record6<String, String, String, byte[], byte[], ProcType>>> entry : groups.entrySet()) {
Result<?> overloads = entry.getValue();
for (int i = 0; i < overloads.size(); i++) {
Record record = overloads.get(i);
SchemaDefinition schema = getSchema(record.get(DB));
String name = record.get(Proc.NAME);
String comment = record.get(Proc.COMMENT);
String params = new String(record.get(Proc.PARAM_LIST));
String returns = new String(record.get(Proc.RETURNS));
ProcType type = record.get(Proc.TYPE);
if (overloads.size() > 1) {
result.add(new MySQLRoutineDefinition(schema, name, comment, params, returns, type, "_" + type.name()));
} else {
result.add(new MySQLRoutineDefinition(schema, name, comment, params, returns, type, null));
}
}
}
return result;
}
Aggregations