com.metamatrix.query.sql.lang
Class SPParameter

java.lang.Object
  extended by com.metamatrix.query.sql.lang.SPParameter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SPParameter
extends java.lang.Object
implements java.io.Serializable, java.lang.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.

See Also:
Serialized Form

Field Summary
static int IN
          Constant identifying an IN parameter
static int INOUT
          Constant identifying an INOUT parameter
static int OUT
          Constant identifying an OUT parameter
static int RESULT_SET
          Constant identifying a RESULT SET parameter
static int RETURN_VALUE
          Constant identifying a RETURN parameter
 
Constructor Summary
SPParameter(int index, Expression expression)
          Constructor used when constructing a parameter during execution.
SPParameter(int index, int parameterType, java.lang.String name)
          Constructor used when constructing a parameter from metadata.
 
Method Summary
 void addResultSetColumn(java.lang.String name, java.lang.Class type, java.lang.Object id)
          Add a result set column if this parameter is a return result set.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
          Checks whether another parameter equals this one based on the index.
 java.lang.Class getClassType()
          Get class type - MetaMatrix runtime types.
 Expression getExpression()
          Return the expression defining the value of this parameter
 int getIndex()
          Return the index of this parameter
 java.lang.Object getMetadataID()
          Get actual metadataID for this parameter
 java.lang.String getName()
          Get full parameter name, including procedure 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.
 java.util.List getResultSetColumns()
          Get the result set columns.
 java.util.List getResultSetIDs()
          Get the result set metadata IDs.
 java.lang.Object getValue()
          This is a helper method to get the value of this parameter when the expression is a constant.
 int hashCode()
           
 boolean isInternal()
          Check whether the parameter is internal or not.
 boolean isUsingDefault()
           
 void setClassType(java.lang.Class classType)
          Set class type - MetaMatrix runtime types.
 void setExpression(Expression expression)
          Set the expression defining this parameter
 void setIndex(int index)
          Set the positional index of this parameter
 void setMetadataID(java.lang.Object metadataID)
          Set actual metadataID for this parameter
 void setName(java.lang.String name)
          Set full parameter name, including procedure name
 void setParameterType(int parameterType)
          Set parameter type according to class constants.
 void setUsingDefault(boolean usingDefault)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 parameter
value - the Value of this parameter

SPParameter

public SPParameter(int index,
                   int parameterType,
                   java.lang.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 index
parameterType - Type of parameter based on class constant - IN, OUT, etc
name - Full name of parameter (including proc name)
Method Detail

getName

public java.lang.String getName()
Get full parameter name, including procedure name. If unknown, null is returned.

Returns:
Parameter name

setName

public void setName(java.lang.String name)
Set full parameter name, including procedure 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(java.lang.Class classType)
Set class type - MetaMatrix runtime types.

Parameters:
classType - See DataTypeManager.DefaultDataClasses for types

getClassType

public java.lang.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

getValue

public java.lang.Object getValue()
This is a helper method to get the value of this parameter when the expression is a constant. It may throw IllegalStateException if used when the expression is not a Constant.

Returns:
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(java.lang.String name,
                               java.lang.Class type,
                               java.lang.Object id)
Add a result set column if this parameter is a return result set.

Parameters:
name - Name of column
type - Type of column

getResultSetColumns

public java.util.List getResultSetColumns()
Get the result set columns. If none exist, return empty list.

Returns:
List of ElementSymbol representing result set columns

getResultSetIDs

public java.util.List 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:
java.lang.IllegalArgumentException - If column doesn't exist

getMetadataID

public java.lang.Object getMetadataID()
Get actual metadataID for this parameter

Returns:
Actual metadata ID for this parameter

setMetadataID

public void setMetadataID(java.lang.Object metadataID)
Set actual metadataID for this parameter

Parameters:
metadataID - Actual metadataID

isInternal

public boolean isInternal()
Check whether the parameter is internal or not. This value is derived from the parameter type.

Returns:
True if parameter is a return value, false otherwise

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(java.lang.Object obj)
Checks whether another parameter equals this one based on the index.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object
See Also:
Object.clone()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

isUsingDefault

public boolean isUsingDefault()

setUsingDefault

public void setUsingDefault(boolean usingDefault)


Copyright © 2009. All Rights Reserved.