if (!sd.isSchemaWithGrantableRoutines())
throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, rd.name.getFullTableName());
AliasDescriptor proc = null;
RoutineAliasInfo routineInfo = null;
java.util.List list = getDataDictionary().getRoutineList(
sd.getUUID().toString(), rd.name.getTableName(),
rd.isFunction ? AliasInfo.ALIAS_NAME_SPACE_FUNCTION_AS_CHAR : AliasInfo.ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR
);
// Can not grant/revoke permissions from self
if (grantees.contains(sd.getAuthorizationId()))
throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED,
rd.name.getFullTableName());
if( rd.paramTypeList == null)
{
// No signature was specified. Make sure that there is exactly one routine with that name.
if( list.size() > 1)
throw StandardException.newException( ( rd.isFunction ? SQLState.LANG_AMBIGUOUS_FUNCTION_NAME
: SQLState.LANG_AMBIGUOUS_PROCEDURE_NAME),
rd.name.getFullTableName());
if( list.size() != 1)
throw StandardException.newException(SQLState.LANG_NO_SUCH_METHOD_ALIAS, rd.name.getFullTableName());
proc = (AliasDescriptor) list.get(0);
}
else
{
// The full signature was specified
boolean found = false;
for (int i = list.size() - 1; (!found) && i >= 0; i--)
{
proc = (AliasDescriptor) list.get(i);
routineInfo = (RoutineAliasInfo) proc.getAliasInfo();
int parameterCount = routineInfo.getParameterCount();
if (parameterCount != rd.paramTypeList.size())
continue;
TypeDescriptor[] parameterTypes = routineInfo.getParameterTypes();
found = true;
for( int parmIdx = 0; parmIdx < parameterCount; parmIdx++)
{
if( ! parameterTypes[parmIdx].equals( rd.paramTypeList.get( parmIdx)))
{