{
case AliasInfo.ALIAS_TYPE_AGGREGATE_AS_CHAR:
this.javaClassName = (String) targetObject;
Object[] aggElements = (Object[]) aliasSpecificInfo;
TypeDescriptor aggForType = bindUserCatalogType( (TypeDescriptor) aggElements[ AGG_FOR_TYPE ] );
TypeDescriptor aggReturnType = bindUserCatalogType( (TypeDescriptor) aggElements[ AGG_RETURN_TYPE ] );
// XML not allowed because SQLXML support has not been implemented
if (
(aggForType.getJDBCTypeId() == Types.SQLXML) ||
(aggReturnType.getJDBCTypeId() == Types.SQLXML)
)
{
throw StandardException.newException( SQLState.LANG_XML_NOT_ALLOWED_DJRS );
}
aliasInfo = new AggregateAliasInfo( aggForType, aggReturnType );
implicitCreateSchema = true;
break;
case AliasInfo.ALIAS_TYPE_UDT_AS_CHAR:
this.javaClassName = (String) targetObject;
aliasInfo = new UDTAliasInfo();
implicitCreateSchema = true;
break;
case AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR:
case AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR:
{
this.javaClassName = (String) targetObject;
this.methodName = methodName;
//routineElements contains the description of the procedure.
//
// 0 - Object[] 3 element array for parameters
// 1 - TableName - specific name
// 2 - Integer - dynamic result set count
// 3 - String language (always java) - ignore
// 4 - String external name (also passed directly to create alias node - ignore
// 5 - Integer parameter style
// 6 - Short - SQL control
// 7 - Boolean - whether the routine is DETERMINISTIC
// 8 - Boolean - CALLED ON NULL INPUT (always TRUE for procedures)
// 9 - TypeDescriptor - return type (always NULL for procedures)
Object[] routineElements = (Object[]) aliasSpecificInfo;
Object[] parameters = (Object[]) routineElements[PARAMETER_ARRAY];
int paramCount = ((List) parameters[0]).size();
// Support for Java signatures in Derby was added in 10.1
// Check to see the catalogs have been upgraded to 10.1 before
// accepting such a method name for a routine. Otherwise
// a routine that works in 10.1 soft upgrade mode would
// exist when running 10.0 but not resolve to anything.
if (this.methodName.indexOf('(') != -1)
{
getDataDictionary().checkVersion(
DataDictionary.DD_VERSION_DERBY_10_1,
"EXTERNAL NAME 'class.method(<signature>)'");
}
String[] names = null;
TypeDescriptor[] types = null;
int[] modes = null;
if (paramCount != 0) {
names = new String[paramCount];
types = new TypeDescriptor[paramCount];
modes = new int[paramCount];
for (int i = 0; i < paramCount; i++) {
names[i] = (String) ((List) parameters[0]).get(i);
types[i] = (TypeDescriptor) ((List) parameters[1]).get(i);
int currentMode = ((Integer) (((List) parameters[2]).get(i))).intValue();
modes[i] = currentMode;
//
// We still don't support XML values as parameters.
// Presumably, the XML datatype would map to a JDBC java.sql.SQLXML type.
// We have no support for that type today.
//
if ( !types[ i ].isUserDefinedType() )
{
if (TypeId.getBuiltInTypeId(types[i].getJDBCTypeId()).isXMLTypeId())
{ throw StandardException.newException(SQLState.LANG_LONG_DATA_TYPE_NOT_ALLOWED, names[i]); }
}
}
if (paramCount > 1) {
String[] dupNameCheck = new String[paramCount];
System.arraycopy(names, 0, dupNameCheck, 0, paramCount);
java.util.Arrays.sort(dupNameCheck);
for (int dnc = 1; dnc < dupNameCheck.length; dnc++) {
if (! dupNameCheck[dnc].equals("") && dupNameCheck[dnc].equals(dupNameCheck[dnc - 1]))
throw StandardException.newException(SQLState.LANG_DB2_DUPLICATE_NAMES, dupNameCheck[dnc], getFullName());
}
}
}
Integer drso = (Integer) routineElements[DYNAMIC_RESULT_SET_COUNT];
int drs = drso == null ? 0 : drso.intValue();
short sqlAllowed;
Short sqlAllowedObject = (Short) routineElements[SQL_CONTROL];
if (sqlAllowedObject != null)
sqlAllowed = sqlAllowedObject.shortValue();
else
sqlAllowed = (this.aliasType == AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR ?
RoutineAliasInfo.MODIFIES_SQL_DATA : RoutineAliasInfo.READS_SQL_DATA);
Boolean isDeterministicO = (Boolean) routineElements[DETERMINISTIC];
boolean isDeterministic = (isDeterministicO == null) ? false : isDeterministicO.booleanValue();
Boolean hasVarargsO = (Boolean) routineElements[ VARARGS ];
boolean hasVarargs = (hasVarargsO == null) ? false : hasVarargsO.booleanValue();
Boolean definersRightsO =
(Boolean) routineElements[ROUTINE_SECURITY_DEFINER];
boolean definersRights =
(definersRightsO == null) ? false :
definersRightsO.booleanValue();
Boolean calledOnNullInputO = (Boolean) routineElements[NULL_ON_NULL_INPUT];
boolean calledOnNullInput;
if (calledOnNullInputO == null)
calledOnNullInput = true;
else
calledOnNullInput = calledOnNullInputO.booleanValue();
// bind the return type if it is a user defined type. this fills
// in the class name.
TypeDescriptor returnType = (TypeDescriptor) routineElements[RETURN_TYPE];
if ( returnType != null )
{
DataTypeDescriptor dtd = DataTypeDescriptor.getType( returnType );
dtd = bindUserType( dtd );