}
break;
}
case FUNCTION_ALIASES: {
for (SchemaObject aliasAsSchemaObject : database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) {
FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject;
for (FunctionAlias.JavaMethod method : alias.getJavaMethods()) {
int returnsResult = method.getDataType() == Value.NULL ? DatabaseMetaData.procedureNoResult
: DatabaseMetaData.procedureReturnsResult;
add(rows,
// ALIAS_CATALOG
catalog,
// ALIAS_SCHEMA
alias.getSchema().getName(),
// ALIAS_NAME
identifier(alias.getName()),
// JAVA_CLASS
alias.getJavaClassName(),
// JAVA_METHOD
alias.getJavaMethodName(),
// DATA_TYPE
"" + DataType.convertTypeToSQLType(method.getDataType()),
// COLUMN_COUNT INT
"" + method.getColumnClasses().length,
// RETURNS_RESULT SMALLINT
"" + returnsResult,
// REMARKS
replaceNullWithEmpty(alias.getComment()),
// ID
"" + alias.getId(),
// SOURCE
alias.getSource()
// when adding more columns, see also below
);
}
}
for (UserAggregate agg : database.getAllAggregates()) {
int returnsResult = DatabaseMetaData.procedureReturnsResult;
add(rows,
// ALIAS_CATALOG
catalog,
// ALIAS_SCHEMA
Constants.SCHEMA_MAIN,
// ALIAS_NAME
identifier(agg.getName()),
// JAVA_CLASS
agg.getJavaClassName(),
// JAVA_METHOD
"",
// DATA_TYPE
"" + DataType.convertTypeToSQLType(Value.NULL),
// COLUMN_COUNT INT
"1",
// RETURNS_RESULT SMALLINT
"" + returnsResult,
// REMARKS
replaceNullWithEmpty(agg.getComment()),
// ID
"" + agg.getId(),
// SOURCE
""
// when adding more columns, see also below
);
}
break;
}
case FUNCTION_COLUMNS: {
for (SchemaObject aliasAsSchemaObject : database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) {
FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject;
for (FunctionAlias.JavaMethod method : alias.getJavaMethods()) {
Class< ? >[] columnList = method.getColumnClasses();
for (int k = 0; k < columnList.length; k++) {
Class< ? > clazz = columnList[k];
int dataType = DataType.getTypeFromClass(clazz);
DataType dt = DataType.getDataType(dataType);
int nullable = clazz.isPrimitive() ? DatabaseMetaData.columnNoNulls
: DatabaseMetaData.columnNullable;
add(rows,
// ALIAS_CATALOG
catalog,
// ALIAS_SCHEMA
alias.getSchema().getName(),
// ALIAS_NAME
identifier(alias.getName()),
// JAVA_CLASS
alias.getJavaClassName(),
// JAVA_METHOD
alias.getJavaMethodName(),
// COLUMN_COUNT
"" + method.getParameterCount(),
// POS INT
"" + k,
// COLUMN_NAME