Package org.apache.derby.catalog.types
Class RoutineAliasInfo
java.lang.Object
org.apache.derby.catalog.types.MethodAliasInfo
org.apache.derby.catalog.types.RoutineAliasInfo
- All Implemented Interfaces:
Externalizable
,Serializable
,AliasInfo
,Formatable
,TypedFormat
Describe a routine (procedure or function) alias.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate char
private boolean
True if the routine is called on null input.static final short
private static final short
private int
static final short
static final short
private int
private int[]
IN, OUT, INOUTprivate String[]
Name of each parameter.private short
Parameter style - always PS_JAVA at the moment.private TypeDescriptor[]
Types of the parameters.static final short
PARAMETER STYLE DERBYstatic final short
PARAMETER STYLE DERBY_JDBC_RESULT_SETstatic final short
PARAMETER STYLE JAVAstatic final short
private TypeDescriptor
Return type for functions.private static final short
private String
SQL Specific name (future)private static final short
Masks for the sqlOptions fieldprivate static final String[]
private short
This field contains several pieces of information: bits 0-3 sqlAllowed = MODIFIES_SQL_DATA, READS_SQL_DATA,CONTAINS_SQL, or NO_SQL bit 4 on if function is DETERMINISTIC, off otherwise bit 5 on if running with definer's right, off otherwiseprivate static final short
Fields inherited from interface org.apache.derby.catalog.AliasInfo
ALIAS_NAME_SPACE_AGGREGATE_AS_CHAR, ALIAS_NAME_SPACE_AGGREGATE_AS_STRING, ALIAS_NAME_SPACE_FUNCTION_AS_CHAR, ALIAS_NAME_SPACE_FUNCTION_AS_STRING, ALIAS_NAME_SPACE_PROCEDURE_AS_CHAR, ALIAS_NAME_SPACE_PROCEDURE_AS_STRING, ALIAS_NAME_SPACE_SYNONYM_AS_CHAR, ALIAS_NAME_SPACE_SYNONYM_AS_STRING, ALIAS_NAME_SPACE_UDT_AS_CHAR, ALIAS_NAME_SPACE_UDT_AS_STRING, ALIAS_TYPE_AGGREGATE_AS_CHAR, ALIAS_TYPE_AGGREGATE_AS_STRING, ALIAS_TYPE_FUNCTION_AS_CHAR, ALIAS_TYPE_FUNCTION_AS_STRING, ALIAS_TYPE_PROCEDURE_AS_CHAR, ALIAS_TYPE_PROCEDURE_AS_STRING, ALIAS_TYPE_SYNONYM_AS_CHAR, ALIAS_TYPE_SYNONYM_AS_STRING, ALIAS_TYPE_UDT_AS_CHAR, ALIAS_TYPE_UDT_AS_STRING
-
Constructor Summary
ConstructorsConstructorDescriptionRoutineAliasInfo
(String methodName, int parameterCount, String[] parameterNames, TypeDescriptor[] parameterTypes, int[] parameterModes, int dynamicResultSets, short parameterStyle, short sqlAllowed, boolean isDeterministic, boolean hasVarargs) Create a RoutineAliasInfo for an internal PROCEDURE.RoutineAliasInfo
(String methodName, int parameterCount, String[] parameterNames, TypeDescriptor[] parameterTypes, int[] parameterModes, int dynamicResultSets, short parameterStyle, short sqlAllowed, boolean isDeterministic, boolean hasVarargs, boolean definersRights, boolean calledOnNullInput, TypeDescriptor returnType) Create a RoutineAliasInfo for a PROCEDURE or FUNCTION -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
int
int[]
String[]
Returns an array containing the names of the parameters.short
Types of the parameters.short
static TypeDescriptor
getStoredType
(Object onDiskType) Old releases (10.3 and before) wrote out the runtime DataTypeDescriptor for routine parameter and return types. 10.4 onwards (DERBY-2775) always writes out the catalog type TypeDescriptor.int
Get the formatID which corresponds to this class.boolean
boolean
boolean
boolean
Return true if this alias is a Table Function.static String
parameterMode
(int parameterMode) void
Read this object from a stream of stored objects.void
setCollationTypeForAllStringTypes
(int collationType) Set the collation type of all string types declared for use in this routine to the given collation type.void
setParameterTypes
(TypeDescriptor[] parameterTypes) Set the paramter types.toString()
Get this alias info as a string.void
Write this object to a stream of stored objects.Methods inherited from class org.apache.derby.catalog.types.MethodAliasInfo
getMethodName
-
Field Details
-
SQL_CONTROL
-
MODIFIES_SQL_DATA
public static final short MODIFIES_SQL_DATA- See Also:
-
READS_SQL_DATA
public static final short READS_SQL_DATA- See Also:
-
CONTAINS_SQL
public static final short CONTAINS_SQL- See Also:
-
NO_SQL
public static final short NO_SQL- See Also:
-
PS_JAVA
public static final short PS_JAVAPARAMETER STYLE JAVA- See Also:
-
PS_DERBY_JDBC_RESULT_SET
public static final short PS_DERBY_JDBC_RESULT_SETPARAMETER STYLE DERBY_JDBC_RESULT_SET- See Also:
-
PS_DERBY
public static final short PS_DERBYPARAMETER STYLE DERBY- See Also:
-
SQL_ALLOWED_MASK
private static final short SQL_ALLOWED_MASKMasks for the sqlOptions field- See Also:
-
DETERMINISTIC_MASK
private static final short DETERMINISTIC_MASK- See Also:
-
SECURITY_DEFINER_MASK
private static final short SECURITY_DEFINER_MASK- See Also:
-
VARARGS_MASK
private static final short VARARGS_MASK- See Also:
-
parameterCount
private int parameterCount -
parameterTypes
Types of the parameters. If there are no parameters then this may be null (or a zero length array). -
parameterNames
Name of each parameter. As of DERBY 10.3, parameter names are optional. If the parameter is unnamed, parameterNames[i] is a string of length 0 -
parameterModes
private int[] parameterModesIN, OUT, INOUT -
dynamicResultSets
private int dynamicResultSets -
returnType
Return type for functions. Null for procedures. -
parameterStyle
private short parameterStyleParameter style - always PS_JAVA at the moment. -
sqlOptions
private short sqlOptionsThis field contains several pieces of information: bits 0-3 sqlAllowed = MODIFIES_SQL_DATA, READS_SQL_DATA,CONTAINS_SQL, or NO_SQL bit 4 on if function is DETERMINISTIC, off otherwise bit 5 on if running with definer's right, off otherwise -
specificName
SQL Specific name (future) -
calledOnNullInput
private boolean calledOnNullInputTrue if the routine is called on null input. (always true for procedures). -
aliasType
private transient char aliasType
-
-
Constructor Details
-
RoutineAliasInfo
public RoutineAliasInfo() -
RoutineAliasInfo
public RoutineAliasInfo(String methodName, int parameterCount, String[] parameterNames, TypeDescriptor[] parameterTypes, int[] parameterModes, int dynamicResultSets, short parameterStyle, short sqlAllowed, boolean isDeterministic, boolean hasVarargs) Create a RoutineAliasInfo for an internal PROCEDURE. -
RoutineAliasInfo
public RoutineAliasInfo(String methodName, int parameterCount, String[] parameterNames, TypeDescriptor[] parameterTypes, int[] parameterModes, int dynamicResultSets, short parameterStyle, short sqlAllowed, boolean isDeterministic, boolean hasVarargs, boolean definersRights, boolean calledOnNullInput, TypeDescriptor returnType) Create a RoutineAliasInfo for a PROCEDURE or FUNCTION
-
-
Method Details
-
getParameterCount
public int getParameterCount() -
getParameterTypes
Types of the parameters. If there are no parameters then this may return null (or a zero length array). -
setParameterTypes
Set the paramter types. Useful if they need to be bound. -
getParameterModes
public int[] getParameterModes() -
getParameterNames
Returns an array containing the names of the parameters. As of DERBY 10.3, parameter names are optional (see DERBY-183 for more information). If the i-th parameter was unnamed, parameterNames[i] will contain a string of length 0. -
getMaxDynamicResultSets
public int getMaxDynamicResultSets() -
getParameterStyle
public short getParameterStyle() -
getSQLAllowed
public short getSQLAllowed() -
isDeterministic
public boolean isDeterministic() -
hasVarargs
public boolean hasVarargs() -
hasDefinersRights
public boolean hasDefinersRights() -
calledOnNullInput
public boolean calledOnNullInput() -
getReturnType
-
isTableFunction
public boolean isTableFunction()Description copied from interface:AliasInfo
Return true if this alias is a Table Function.- Specified by:
isTableFunction
in interfaceAliasInfo
- Overrides:
isTableFunction
in classMethodAliasInfo
-
readExternal
Read this object from a stream of stored objects.- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classMethodAliasInfo
- Parameters:
in
- read this.- Throws:
IOException
- thrown on errorClassNotFoundException
- thrown on error
-
getStoredType
Old releases (10.3 and before) wrote out the runtime DataTypeDescriptor for routine parameter and return types. 10.4 onwards (DERBY-2775) always writes out the catalog type TypeDescriptor. Here we see what object was read from disk and if it was the old type, now mapped to OldRoutineType, we extract the catalog type and use that.- Parameters:
onDiskType
- The object read that represents the type.- Returns:
- A type descriptor.
-
writeExternal
Write this object to a stream of stored objects.- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classMethodAliasInfo
- Parameters:
out
- write bytes here.- Throws:
IOException
- thrown on error
-
getTypeFormatId
public int getTypeFormatId()Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Overrides:
getTypeFormatId
in classMethodAliasInfo
- Returns:
- the formatID of this class
-
toString
Get this alias info as a string. NOTE: The "ALIASINFO" column in the SYSALIASES table will return the result of this method on a ResultSet.getString() call. That said, since the dblook utility uses ResultSet.getString() to retrieve ALIASINFO and to generate the DDL, THIS METHOD MUST RETURN A STRING THAT IS SYNTACTICALLY VALID, or else the DDL generated by dblook will be incorrect.- Overrides:
toString
in classMethodAliasInfo
- See Also:
-
parameterMode
-
setCollationTypeForAllStringTypes
public void setCollationTypeForAllStringTypes(int collationType) Set the collation type of all string types declared for use in this routine to the given collation type.- Parameters:
collationType
-
-