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:
java.io.Externalizable,java.io.Serializable,AliasInfo,Formatable,TypedFormat
public class RoutineAliasInfo extends MethodAliasInfo
Describe a routine (procedure or function) alias.- See Also:
AliasInfo, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private charaliasTypeprivate booleancalledOnNullInputTrue if the routine is called on null input.static shortCONTAINS_SQLprivate static shortDETERMINISTIC_MASKprivate intdynamicResultSetsstatic shortMODIFIES_SQL_DATAstatic shortNO_SQLprivate intparameterCountprivate int[]parameterModesIN, OUT, INOUTprivate java.lang.String[]parameterNamesName of each parameter.private shortparameterStyleParameter style - always PS_JAVA at the moment.private TypeDescriptor[]parameterTypesTypes of the parameters.static shortPS_DERBYPARAMETER STYLE DERBYstatic shortPS_DERBY_JDBC_RESULT_SETPARAMETER STYLE DERBY_JDBC_RESULT_SETstatic shortPS_JAVAPARAMETER STYLE JAVAstatic shortREADS_SQL_DATAprivate TypeDescriptorreturnTypeReturn type for functions.private static shortSECURITY_DEFINER_MASKprivate java.lang.StringspecificNameSQL Specific name (future)private static shortSQL_ALLOWED_MASKMasks for the sqlOptions fieldprivate static java.lang.String[]SQL_CONTROLprivate shortsqlOptionsThis 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 shortVARARGS_MASK-
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
Constructors Constructor Description RoutineAliasInfo()RoutineAliasInfo(java.lang.String methodName, int parameterCount, java.lang.String[] parameterNames, TypeDescriptor[] parameterTypes, int[] parameterModes, int dynamicResultSets, short parameterStyle, short sqlAllowed, boolean isDeterministic, boolean hasVarargs)Create a RoutineAliasInfo for an internal PROCEDURE.RoutineAliasInfo(java.lang.String methodName, int parameterCount, java.lang.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancalledOnNullInput()intgetMaxDynamicResultSets()intgetParameterCount()int[]getParameterModes()java.lang.String[]getParameterNames()Returns an array containing the names of the parameters.shortgetParameterStyle()TypeDescriptor[]getParameterTypes()Types of the parameters.TypeDescriptorgetReturnType()shortgetSQLAllowed()static TypeDescriptorgetStoredType(java.lang.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.intgetTypeFormatId()Get the formatID which corresponds to this class.booleanhasDefinersRights()booleanhasVarargs()booleanisDeterministic()booleanisTableFunction()Return true if this alias is a Table Function.static java.lang.StringparameterMode(int parameterMode)voidreadExternal(java.io.ObjectInput in)Read this object from a stream of stored objects.voidsetCollationTypeForAllStringTypes(int collationType)Set the collation type of all string types declared for use in this routine to the given collation type.voidsetParameterTypes(TypeDescriptor[] parameterTypes)Set the paramter types.java.lang.StringtoString()Get this alias info as a string.voidwriteExternal(java.io.ObjectOutput out)Write this object to a stream of stored objects.-
Methods inherited from class org.apache.derby.catalog.types.MethodAliasInfo
getMethodName
-
-
-
-
Field Detail
-
SQL_CONTROL
private static final java.lang.String[] SQL_CONTROL
-
MODIFIES_SQL_DATA
public static final short MODIFIES_SQL_DATA
- See Also:
- Constant Field Values
-
READS_SQL_DATA
public static final short READS_SQL_DATA
- See Also:
- Constant Field Values
-
CONTAINS_SQL
public static final short CONTAINS_SQL
- See Also:
- Constant Field Values
-
NO_SQL
public static final short NO_SQL
- See Also:
- Constant Field Values
-
PS_JAVA
public static final short PS_JAVA
PARAMETER STYLE JAVA- See Also:
- Constant Field Values
-
PS_DERBY_JDBC_RESULT_SET
public static final short PS_DERBY_JDBC_RESULT_SET
PARAMETER STYLE DERBY_JDBC_RESULT_SET- See Also:
- Constant Field Values
-
PS_DERBY
public static final short PS_DERBY
PARAMETER STYLE DERBY- See Also:
- Constant Field Values
-
SQL_ALLOWED_MASK
private static final short SQL_ALLOWED_MASK
Masks for the sqlOptions field- See Also:
- Constant Field Values
-
DETERMINISTIC_MASK
private static final short DETERMINISTIC_MASK
- See Also:
- Constant Field Values
-
SECURITY_DEFINER_MASK
private static final short SECURITY_DEFINER_MASK
- See Also:
- Constant Field Values
-
VARARGS_MASK
private static final short VARARGS_MASK
- See Also:
- Constant Field Values
-
parameterCount
private int parameterCount
-
parameterTypes
private TypeDescriptor[] parameterTypes
Types of the parameters. If there are no parameters then this may be null (or a zero length array).
-
parameterNames
private java.lang.String[] 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[] parameterModes
IN, OUT, INOUT
-
dynamicResultSets
private int dynamicResultSets
-
returnType
private TypeDescriptor returnType
Return type for functions. Null for procedures.
-
parameterStyle
private short parameterStyle
Parameter style - always PS_JAVA at the moment.
-
sqlOptions
private short sqlOptions
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 otherwise
-
specificName
private java.lang.String specificName
SQL Specific name (future)
-
calledOnNullInput
private boolean calledOnNullInput
True if the routine is called on null input. (always true for procedures).
-
aliasType
private transient char aliasType
-
-
Constructor Detail
-
RoutineAliasInfo
public RoutineAliasInfo()
-
RoutineAliasInfo
public RoutineAliasInfo(java.lang.String methodName, int parameterCount, java.lang.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(java.lang.String methodName, int parameterCount, java.lang.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 Detail
-
getParameterCount
public int getParameterCount()
-
getParameterTypes
public TypeDescriptor[] getParameterTypes()
Types of the parameters. If there are no parameters then this may return null (or a zero length array).
-
setParameterTypes
public void setParameterTypes(TypeDescriptor[] parameterTypes)
Set the paramter types. Useful if they need to be bound.
-
getParameterModes
public int[] getParameterModes()
-
getParameterNames
public java.lang.String[] 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
public TypeDescriptor getReturnType()
-
isTableFunction
public boolean isTableFunction()
Description copied from interface:AliasInfoReturn true if this alias is a Table Function.- Specified by:
isTableFunctionin interfaceAliasInfo- Overrides:
isTableFunctionin classMethodAliasInfo
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this object from a stream of stored objects.- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classMethodAliasInfo- Parameters:
in- read this.- Throws:
java.io.IOException- thrown on errorjava.lang.ClassNotFoundException- thrown on error
-
getStoredType
public static TypeDescriptor getStoredType(java.lang.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. 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
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionWrite this object to a stream of stored objects.- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classMethodAliasInfo- Parameters:
out- write bytes here.- Throws:
java.io.IOException- thrown on error
-
getTypeFormatId
public int getTypeFormatId()
Get the formatID which corresponds to this class.- Specified by:
getTypeFormatIdin interfaceTypedFormat- Overrides:
getTypeFormatIdin classMethodAliasInfo- Returns:
- the formatID of this class
-
toString
public java.lang.String 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:
toStringin classMethodAliasInfo- See Also:
Object.toString()
-
parameterMode
public static java.lang.String parameterMode(int 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-
-
-