int columnCount;
Iterator routines;
RoutineSchema routineSchema;
Routine routine;
Object[] row;
Type type;
// Initialization
boolean translateDTI = database.getProperties().isPropertyTrue(
HsqlDatabaseProperties.jdbc_translate_dti_types);
routines = database.schemaManager.databaseObjectIterator(
SchemaObject.ROUTINE);
while (routines.hasNext()) {
routineSchema = (RoutineSchema) routines.next();
if (!session.getGrantee().isAccessible(routineSchema)) {
continue;
}
Routine[] specifics = routineSchema.getSpecificRoutines();
for (int i = 0; i < specifics.length; i++) {
routine = specifics[i];
columnCount = routine.getParameterCount();
for (int j = 0; j < columnCount; j++) {
ColumnSchema column = routine.getParameter(j);
row = t.getEmptyRowData();
type = column.getDataType();
if (translateDTI) {
if (type.isIntervalType()) {
type = CharacterType.getCharacterType(
Types.SQL_VARCHAR, type.displaySize());
} else if (type.isDateTimeTypeWithZone()) {
type = ((DateTimeType) type)
.getDateTimeTypeWithoutZone();
}
}
row[specific_cat] = database.getCatalogName().name;
row[specific_schem] = routine.getSchemaName().name;
row[specific_name] = routine.getSpecificName().name;
row[procedure_name] = routine.getName().name;
row[parameter_name] = column.getName().name;
row[ordinal_position] = ValuePool.getInt(j + 1);
row[parameter_mode] =
ValuePool.getInt(column.getParameterMode());
row[data_type] = type.getFullNameString();
row[data_type_sql_id] =
ValuePool.getInt(type.getJDBCTypeCode());
row[numeric_precision] = ValuePool.INTEGER_0;
row[character_octet_length] = ValuePool.INTEGER_0;
if (type.isCharacterType()) {
row[numeric_precision] =
ValuePool.getInt(type.getJDBCPrecision());
// this is length not octet_length, for character columns
row[character_octet_length] =
ValuePool.getInt(type.getJDBCPrecision());
}
if (type.isBinaryType()) {
row[numeric_precision] =
ValuePool.getInt(type.getJDBCPrecision());
row[character_octet_length] =
ValuePool.getInt(type.getJDBCPrecision());
}
if (type.isNumberType()) {
row[numeric_precision] = ValuePool.getInt(
((NumberType) type).getNumericPrecisionInRadix());
row[numeric_precision_radix] =
ValuePool.getLong(type.getPrecisionRadix());
if (type.isExactNumberType()) {
row[numeric_scale] = ValuePool.getLong(type.scale);
}
}
if (type.isDateTimeType()) {
int size = (int) column.getDataType().displaySize();
row[numeric_precision] = ValuePool.getInt(size);
}