Package org.teiid.query.sql.lang
Class SPParameter
- java.lang.Object
-
- org.teiid.query.sql.lang.SPParameter
-
- All Implemented Interfaces:
Cloneable
public class SPParameter extends Object implements Cloneable
Represents a StoredProcedure's parameter for encapsulation in the Query framework This is basically a holder object set from the Server's implementation of a stored procedure. The connector will utilize this class to set the appropriate values at the datasource layer.
-
-
Field Summary
Fields Modifier and Type Field Description static int
IN
Constant identifying an IN parameterstatic int
INOUT
Constant identifying an INOUT parameterstatic int
OUT
Constant identifying an OUT parameterstatic int
RESULT_SET
Constant identifying a RESULT SET parameterstatic int
RETURN_VALUE
Constant identifying a RETURN parameter
-
Constructor Summary
Constructors Constructor Description SPParameter(int index, int parameterType, String name)
Constructor used when constructing a parameter from metadata.SPParameter(int index, Expression expression)
Constructor used when constructing a parameter during execution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResultSetColumn(String colName, Class<?> type, Object id)
Add a result set column if this parameter is a return result set.Object
clone()
boolean
equals(Object obj)
Checks whether another parameter equals this one based on the index.Class<?>
getClassType()
Get class type - MetaMatrix runtime types.Expression
getExpression()
Return the expression defining the value of this parameterint
getIndex()
Return the index of this parameterObject
getMetadataID()
Get actual metadataID for this parameterString
getName()
Get full parameter name,.ElementSymbol
getParameterSymbol()
Get element symbol representing this parameter.int
getParameterType()
Get type of parameter according to class constants.ElementSymbol
getResultSetColumn(int position)
Get a particular result set column at the specified position.List<ElementSymbol>
getResultSetColumns()
Get the result set columns.List<Object>
getResultSetIDs()
Get the result set metadata IDs.int
hashCode()
boolean
isUsingDefault()
boolean
isVarArg()
void
setClassType(Class<?> classType)
Set class type - MetaMatrix runtime types.void
setExpression(Expression expression)
Set the expression defining this parametervoid
setIndex(int index)
Set the positional index of this parametervoid
setMetadataID(Object metadataID)
Set actual metadataID for this parametervoid
setName(String name)
Set full parameter namevoid
setParameterType(int parameterType)
Set parameter type according to class constants.void
setUsingDefault(boolean usingDefault)
void
setVarArg(boolean varArg)
String
toString()
-
-
-
Field Detail
-
IN
public static final int IN
Constant identifying an IN parameter- See Also:
- Constant Field Values
-
OUT
public static final int OUT
Constant identifying an OUT parameter- See Also:
- Constant Field Values
-
INOUT
public static final int INOUT
Constant identifying an INOUT parameter- See Also:
- Constant Field Values
-
RETURN_VALUE
public static final int RETURN_VALUE
Constant identifying a RETURN parameter- See Also:
- Constant Field Values
-
RESULT_SET
public static final int RESULT_SET
Constant identifying a RESULT SET parameter- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SPParameter
public SPParameter(int index, Expression expression)
Constructor used when constructing a parameter during execution. In this case we know what the parameter is being filled with but no metadata about the parameter.- Parameters:
index
- the positional index of this parameterexpression
- the Value of this parameter
-
SPParameter
public SPParameter(int index, int parameterType, String name)
Constructor used when constructing a parameter from metadata. In this case we specify the description of the parameter but no notion of what it is being filled with.- Parameters:
index
- Parameter indexparameterType
- Type of parameter based on class constant - IN, OUT, etcname
- Full name of parameter (including proc name)
-
-
Method Detail
-
getName
public String getName()
Get full parameter name,. If unknown, null is returned.- Returns:
- Parameter name
-
setName
public void setName(String name)
Set full parameter name- Parameters:
name
- Parameter name
-
setParameterType
public void setParameterType(int parameterType)
Set parameter type according to class constants.- Parameters:
parameterType
- Type to set- See Also:
ParameterInfo.IN
,ParameterInfo.OUT
,ParameterInfo.INOUT
,ParameterInfo.RESULT_SET
,ParameterInfo.RETURN_VALUE
-
getParameterType
public int getParameterType()
Get type of parameter according to class constants.- Returns:
- Parameter type
- See Also:
ParameterInfo.IN
,ParameterInfo.OUT
,ParameterInfo.INOUT
,ParameterInfo.RESULT_SET
,ParameterInfo.RETURN_VALUE
-
setClassType
public void setClassType(Class<?> classType)
Set class type - MetaMatrix runtime types.- Parameters:
classType
- SeeDataTypeManager.DefaultDataClasses
for types
-
getClassType
public Class<?> getClassType()
Get class type - MetaMatrix runtime types.- Returns:
- MetaMatrix runtime type description
-
setExpression
public void setExpression(Expression expression)
Set the expression defining this parameter- Parameters:
expression
- The expression defining this parameter's value
-
getExpression
public Expression getExpression()
Return the expression defining the value of this parameter- Returns:
- Expression defining the value of this parameter
-
setIndex
public void setIndex(int index)
Set the positional index of this parameter- Parameters:
index
- The positional index of this parameter
-
getIndex
public int getIndex()
Return the index of this parameter- Returns:
- The index
-
addResultSetColumn
public void addResultSetColumn(String colName, Class<?> type, Object id)
Add a result set column if this parameter is a return result set.- Parameters:
colName
- Name of columntype
- Type of column
-
getResultSetColumns
public List<ElementSymbol> getResultSetColumns()
Get the result set columns. If none exist, return empty list.- Returns:
- List of ElementSymbol representing result set columns
-
getResultSetIDs
public List<Object> getResultSetIDs()
Get the result set metadata IDs. If none exist, return empty list.- Returns:
- List of Object representing result set metadata IDs
-
getResultSetColumn
public ElementSymbol getResultSetColumn(int position)
Get a particular result set column at the specified position.- Parameters:
position
- Position of the result set column- Returns:
- Element symbol representing the result set column at position
- Throws:
IllegalArgumentException
- If column doesn't exist
-
getMetadataID
public Object getMetadataID()
Get actual metadataID for this parameter- Returns:
- Actual metadata ID for this parameter
-
setMetadataID
public void setMetadataID(Object metadataID)
Set actual metadataID for this parameter- Parameters:
metadataID
- Actual metadataID
-
getParameterSymbol
public ElementSymbol getParameterSymbol()
Get element symbol representing this parameter. The symbol will have the same name and type as the parameter.- Returns:
- Element symbol representing the parameter
-
equals
public boolean equals(Object obj)
Checks whether another parameter equals this one based on the index.- Overrides:
equals
in classObject
- See Also:
Object.equals(Object)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classObject
- See Also:
Object.hashCode()
-
clone
public Object clone()
- Overrides:
clone
in classObject
- See Also:
Object.clone()
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
isUsingDefault
public boolean isUsingDefault()
-
setUsingDefault
public void setUsingDefault(boolean usingDefault)
-
setVarArg
public void setVarArg(boolean varArg)
-
isVarArg
public boolean isVarArg()
-
-