use of org.jooq.meta.DefaultParameterDefinition in project jOOQ by jOOQ.
the class XMLRoutineDefinition method init0.
@Override
protected void init0() {
for (Parameter parameter : info.getParameters()) {
Name parameterRoutineName = name(parameter.getSpecificCatalog(), parameter.getSpecificSchema(), parameter.getSpecificPackage(), parameter.getSpecificName());
if (specificName.equals(parameterRoutineName)) {
DataTypeDefinition type = new DefaultDataTypeDefinition(getDatabase(), getSchema(), parameter.getDataType(), parameter.getCharacterMaximumLength(), parameter.getNumericPrecision(), parameter.getNumericScale(), null, parameter.getParameterDefault());
ParameterDefinition p = new DefaultParameterDefinition(this, parameter.getParameterName(), parameter.getOrdinalPosition(), type, !StringUtils.isBlank(parameter.getParameterDefault()), StringUtils.isBlank(parameter.getParameterName()), parameter.getComment());
switch(parameter.getParameterMode()) {
case IN:
addParameter(InOutDefinition.IN, p);
break;
case INOUT:
addParameter(InOutDefinition.INOUT, p);
break;
case OUT:
addParameter(InOutDefinition.OUT, p);
break;
}
}
}
}
use of org.jooq.meta.DefaultParameterDefinition in project jOOQ by jOOQ.
the class H2RoutineDefinition method init1_4.
private void init1_4() {
for (Record record : create().select(FUNCTION_COLUMNS.COLUMN_NAME, FUNCTION_COLUMNS.TYPE_NAME, FUNCTION_COLUMNS.PRECISION, FUNCTION_COLUMNS.SCALE, FUNCTION_COLUMNS.POS, FUNCTION_COLUMNS.NULLABLE, FUNCTION_COLUMNS.COLUMN_DEFAULT).from(FUNCTION_COLUMNS).where(FUNCTION_COLUMNS.ALIAS_SCHEMA.equal(getSchema().getName())).and(FUNCTION_COLUMNS.ALIAS_NAME.equal(getName())).and(FUNCTION_COLUMNS.POS.gt(0)).and(getOverload() == null ? noCondition() : FUNCTION_COLUMNS.COLUMN_COUNT.eq(FUNCTION_COLUMNS.COLUMN_COUNT.getDataType().convert(getOverload()))).orderBy(FUNCTION_COLUMNS.POS.asc()).fetch()) {
String paramName = record.get(FUNCTION_COLUMNS.COLUMN_NAME);
String typeName = record.get(FUNCTION_COLUMNS.TYPE_NAME);
Integer precision = record.get(FUNCTION_COLUMNS.PRECISION);
Short scale = record.get(FUNCTION_COLUMNS.SCALE);
int position = record.get(FUNCTION_COLUMNS.POS);
boolean nullable = record.get(FUNCTION_COLUMNS.NULLABLE, boolean.class);
String defaultValue = record.get(FUNCTION_COLUMNS.COLUMN_DEFAULT);
// It is only used internally by H2 to provide a connection to the current database.
if (position == 0 && H2DataType.OTHER.getTypeName().equalsIgnoreCase(typeName)) {
continue;
}
DataTypeDefinition type = new DefaultDataTypeDefinition(getDatabase(), getSchema(), typeName, precision, precision, scale, nullable, defaultValue);
ParameterDefinition parameter = new DefaultParameterDefinition(this, paramName, position, type);
addParameter(InOutDefinition.IN, parameter);
}
}
use of org.jooq.meta.DefaultParameterDefinition in project jOOQ by jOOQ.
the class HSQLDBRoutineDefinition method init0.
@Override
protected void init0() throws SQLException {
Result<?> result = create().select(PARAMETERS.PARAMETER_MODE, PARAMETERS.PARAMETER_NAME, nvl(ELEMENT_TYPES.COLLECTION_TYPE_IDENTIFIER, PARAMETERS.DATA_TYPE).as("datatype"), PARAMETERS.CHARACTER_MAXIMUM_LENGTH, PARAMETERS.NUMERIC_PRECISION, PARAMETERS.NUMERIC_SCALE, PARAMETERS.ORDINAL_POSITION).from(PARAMETERS).join(ROUTINES).on(PARAMETERS.SPECIFIC_SCHEMA.equal(ROUTINES.SPECIFIC_SCHEMA)).and(PARAMETERS.SPECIFIC_NAME.equal(ROUTINES.SPECIFIC_NAME)).leftOuterJoin(ELEMENT_TYPES).on(ROUTINES.ROUTINE_SCHEMA.equal(ELEMENT_TYPES.OBJECT_SCHEMA)).and(ROUTINES.ROUTINE_NAME.equal(ELEMENT_TYPES.OBJECT_NAME)).and(PARAMETERS.DTD_IDENTIFIER.equal(ELEMENT_TYPES.COLLECTION_TYPE_IDENTIFIER)).where(PARAMETERS.SPECIFIC_SCHEMA.equal(getSchema().getName())).and(PARAMETERS.SPECIFIC_NAME.equal(this.specificName)).and(condition(val(!isAggregate())).or(PARAMETERS.ORDINAL_POSITION.eq(1L))).orderBy(PARAMETERS.ORDINAL_POSITION.asc()).fetch();
for (Record record : result) {
String inOut = record.get(PARAMETERS.PARAMETER_MODE);
DataTypeDefinition type = new DefaultDataTypeDefinition(getDatabase(), getSchema(), record.get("datatype", String.class), record.get(PARAMETERS.CHARACTER_MAXIMUM_LENGTH), record.get(PARAMETERS.NUMERIC_PRECISION), record.get(PARAMETERS.NUMERIC_SCALE), null, (String) null);
ParameterDefinition parameter = new DefaultParameterDefinition(this, record.get(PARAMETERS.PARAMETER_NAME).replaceAll("@", ""), record.get(PARAMETERS.ORDINAL_POSITION, int.class), type);
addParameter(InOutDefinition.getFromString(inOut), parameter);
}
}
Aggregations