Package org.teiid.query.sql.proc
Class DeclareStatement
- java.lang.Object
-
- org.teiid.query.sql.proc.Statement
-
- org.teiid.query.sql.proc.AssignmentStatement
-
- org.teiid.query.sql.proc.DeclareStatement
-
- All Implemented Interfaces:
Cloneable
,LanguageObject
,ExpressionStatement
public class DeclareStatement extends AssignmentStatement
This class represents a statement used to declare variables in the storedprocedure language.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.teiid.query.sql.proc.Statement
Statement.Labeled
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Field Summary
-
Fields inherited from class org.teiid.query.sql.proc.Statement
TYPE_ASSIGNMENT, TYPE_BREAK, TYPE_COMMAND, TYPE_COMPOUND, TYPE_CONTINUE, TYPE_DECLARE, TYPE_ERROR, TYPE_IF, TYPE_LEAVE, TYPE_LOOP, TYPE_RETURN, TYPE_UNKNOWN, TYPE_UPDATE, TYPE_WHILE
-
-
Constructor Summary
Constructors Constructor Description DeclareStatement()
Constructor for DeclareStatement.DeclareStatement(ElementSymbol variable, String varType)
Constructor for DeclareStatement.DeclareStatement(ElementSymbol variable, String varType, Command value)
Deprecated.DeclareStatement(ElementSymbol variable, String varType, Expression value)
Constructor for DeclareStatement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.Object
clone()
Deep clone statement to produce a new identical statement.boolean
equals(Object obj)
Compare two DeclareStatements for equality.int
getType()
Return the type for this statement, this is one of the types defined on the statement object.String
getVariableType()
Get the type of this variable declared in this statement.int
hashCode()
Get hashcode for TableAssignmentStatement.void
setVariableType(String varType)
Set the type of this variable declared in this statement.String
toString()
Returns a string representation of an instance of this class.-
Methods inherited from class org.teiid.query.sql.proc.AssignmentStatement
getCommand, getExpectedType, getExpression, getVariable, setCommand, setExpression, setVariable
-
-
-
-
Constructor Detail
-
DeclareStatement
public DeclareStatement()
Constructor for DeclareStatement.
-
DeclareStatement
public DeclareStatement(ElementSymbol variable, String varType)
Constructor for DeclareStatement.- Parameters:
variable
- TheElementSymbol
object that is the variablevarType
- The type of this variable
-
DeclareStatement
public DeclareStatement(ElementSymbol variable, String varType, Expression value)
Constructor for DeclareStatement.- Parameters:
variable
- TheElementSymbol
object that is the variablevarType
- The type of this variable
-
DeclareStatement
@Deprecated public DeclareStatement(ElementSymbol variable, String varType, Command value)
Deprecated.
-
-
Method Detail
-
getVariableType
public String getVariableType()
Get the type of this variable declared in this statement.- Returns:
- A string giving the variable type
-
setVariableType
public void setVariableType(String varType)
Set the type of this variable declared in this statement.- Parameters:
varType
- A string giving the variable type
-
getType
public int getType()
Return the type for this statement, this is one of the types defined on the statement object.- Overrides:
getType
in classAssignmentStatement
- Returns:
- The type of this statement
-
acceptVisitor
public void acceptVisitor(LanguageVisitor visitor)
Description copied from interface:LanguageObject
Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.- Specified by:
acceptVisitor
in interfaceLanguageObject
- Overrides:
acceptVisitor
in classAssignmentStatement
- Parameters:
visitor
- Visitor being used
-
clone
public Object clone()
Deep clone statement to produce a new identical statement.- Specified by:
clone
in interfaceLanguageObject
- Overrides:
clone
in classAssignmentStatement
- Returns:
- Deep clone
-
equals
public boolean equals(Object obj)
Compare two DeclareStatements for equality. They will only evaluate to equal if they are IDENTICAL: variable and the its type are equal.- Overrides:
equals
in classAssignmentStatement
- Parameters:
obj
- Other object- Returns:
- True if equal
-
hashCode
public int hashCode()
Get hashcode for TableAssignmentStatement. WARNING: This hash code relies on the hash codes of the statements present in the block. If statements are added to the block or if statements on the block change the hash code will change. Hash code is only valid after the block has been completely constructed.- Overrides:
hashCode
in classAssignmentStatement
- Returns:
- Hash code
-
-