Search in sources :

Example 6 with Rdb$procedureParameters

use of org.jooq.util.firebird.rdb.tables.Rdb$procedureParameters in project jOOQ by jOOQ.

the class FirebirdTableValuedFunction method getElements0.

@Override
protected List<ColumnDefinition> getElements0() throws SQLException {
    List<ColumnDefinition> result = new ArrayList<>();
    Rdb$procedureParameters p = RDB$PROCEDURE_PARAMETERS.as("p");
    Rdb$fields f = RDB$FIELDS.as("f");
    // DatabaseMetaData implementation
    for (Record record : create().select(p.RDB$PARAMETER_NUMBER, p.RDB$PARAMETER_NAME.trim(), p.RDB$DESCRIPTION, p.RDB$DEFAULT_VALUE, DSL.bitOr(p.RDB$NULL_FLAG.nvl((short) 0), f.RDB$NULL_FLAG.nvl((short) 0)).as(p.RDB$NULL_FLAG), p.RDB$DEFAULT_SOURCE, // [#3342] FIELD_LENGTH should be ignored for LOBs
    CHARACTER_LENGTH(f).as("CHAR_LEN"), f.RDB$FIELD_PRECISION, FIELD_SCALE(f).as("FIELD_SCALE"), FIELD_TYPE(f).as("FIELD_TYPE"), f.RDB$FIELD_SUB_TYPE).from(p).leftOuterJoin(f).on(p.RDB$FIELD_SOURCE.eq(f.RDB$FIELD_NAME)).where(p.RDB$PROCEDURE_NAME.eq(getName())).and(p.RDB$PARAMETER_TYPE.eq((short) 1)).orderBy(p.RDB$PARAMETER_NUMBER)) {
        DefaultDataTypeDefinition type = new DefaultDataTypeDefinition(getDatabase(), getSchema(), record.get("FIELD_TYPE", String.class), record.get("CHAR_LEN", short.class), record.get(f.RDB$FIELD_PRECISION), record.get("FIELD_SCALE", Integer.class), record.get(p.RDB$NULL_FLAG) == 0, record.get(p.RDB$DEFAULT_SOURCE));
        result.add(new DefaultColumnDefinition(getDatabase().getTable(getSchema(), getName()), record.get(p.RDB$PARAMETER_NAME.trim()), result.size() + 1, type, false, null));
    }
    return result;
}
Also used : DefaultDataTypeDefinition(org.jooq.meta.DefaultDataTypeDefinition) DefaultColumnDefinition(org.jooq.meta.DefaultColumnDefinition) Rdb$fields(org.jooq.meta.firebird.rdb.tables.Rdb$fields) ArrayList(java.util.ArrayList) Record(org.jooq.Record) Rdb$procedureParameters(org.jooq.meta.firebird.rdb.tables.Rdb$procedureParameters) DefaultColumnDefinition(org.jooq.meta.DefaultColumnDefinition) ColumnDefinition(org.jooq.meta.ColumnDefinition)

Aggregations

Record (org.jooq.Record)6 ArrayList (java.util.ArrayList)3 ColumnDefinition (org.jooq.util.ColumnDefinition)3 DefaultDataTypeDefinition (org.jooq.util.DefaultDataTypeDefinition)3 Rdb$fields (org.jooq.util.firebird.rdb.tables.Rdb$fields)3 DefaultDataTypeDefinition (org.jooq.meta.DefaultDataTypeDefinition)2 Rdb$fields (org.jooq.meta.firebird.rdb.tables.Rdb$fields)2 Rdb$procedureParameters (org.jooq.meta.firebird.rdb.tables.Rdb$procedureParameters)2 DefaultColumnDefinition (org.jooq.util.DefaultColumnDefinition)2 Rdb$procedureParameters (org.jooq.util.firebird.rdb.tables.Rdb$procedureParameters)2 ColumnDefinition (org.jooq.meta.ColumnDefinition)1 DataTypeDefinition (org.jooq.meta.DataTypeDefinition)1 DefaultColumnDefinition (org.jooq.meta.DefaultColumnDefinition)1 DefaultParameterDefinition (org.jooq.meta.DefaultParameterDefinition)1 ParameterDefinition (org.jooq.meta.ParameterDefinition)1 Rdb$functionArguments (org.jooq.meta.firebird.rdb.tables.Rdb$functionArguments)1 DataTypeDefinition (org.jooq.util.DataTypeDefinition)1 DefaultParameterDefinition (org.jooq.util.DefaultParameterDefinition)1 ParameterDefinition (org.jooq.util.ParameterDefinition)1 TableDefinition (org.jooq.util.TableDefinition)1