org.teiid.query.sql.lang
Class Insert
java.lang.Object
org.teiid.query.sql.lang.Command
org.teiid.query.sql.lang.ProcedureContainer
org.teiid.query.sql.lang.Insert
- All Implemented Interfaces:
- java.lang.Cloneable, LanguageObject
public class Insert
- extends ProcedureContainer
Represents a SQL Insert statement of the form:
"INSERT INTO () VALUES ".
Fields inherited from class org.teiid.query.sql.lang.Command |
tempGroupIDs, TYPE_BATCHED_UPDATE, TYPE_CREATE, TYPE_DELETE, TYPE_DROP, TYPE_DYNAMIC, TYPE_INSERT, TYPE_QUERY, TYPE_SQL, TYPE_STORED_PROCEDURE, TYPE_UNKNOWN, TYPE_UPDATE, TYPE_UPDATE_PROCEDURE |
Constructor Summary |
Insert()
Constructs a default instance of this class. |
Insert(GroupSymbol group,
java.util.List variables,
java.util.List values)
Construct an instance with group, variable list (may be null), and values |
Methods inherited from class org.teiid.query.sql.lang.Command |
addExternalGroupsToContext, addExternalGroupToContext, copyMetadataState, getAllExternalGroups, getCacheHint, getCorrelatedReferences, getExternalGroupContexts, getOption, getProcessorPlan, getSubCommands, getTemporaryMetadata, getUpdateCommandSymbol, isResolved, printCommandTree, printCommandTree, pushNewResolvingContext, returnsResultSet, sameOptionAndHint, setCacheHint, setCorrelatedReferences, setExternalGroupContexts, setIsResolved, setOption, setProcessorPlan, setTemporaryMetadata, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Insert
public Insert()
- Constructs a default instance of this class.
Insert
public Insert(GroupSymbol group,
java.util.List variables,
java.util.List values)
- Construct an instance with group, variable list (may be null), and values
- Parameters:
group
- Group associated with this insertvariables
- List of ElementSymbols that represent columns for the values, null implies all columnsvalues
- List of Expression values to be inserted
getType
public int getType()
- Return type of command.
- Specified by:
getType
in class Command
- Returns:
- TYPE_INSERT
getGroup
public GroupSymbol getGroup()
- Returns the group being inserted into
- Specified by:
getGroup
in class ProcedureContainer
- Returns:
- Group being inserted into
setGroup
public void setGroup(GroupSymbol group)
- Set the group for this insert statement
- Parameters:
group
- Group to be inserted into
isBulk
public boolean isBulk()
getVariables
public java.util.List getVariables()
- Return an ordered List of variables, may be null if no columns were specified
- Returns:
- List of
ElementSymbol
addVariable
public void addVariable(ElementSymbol var)
- Add a variable to end of list
- Parameters:
var
- Variable to add to the list
addVariables
public void addVariables(java.util.Collection vars)
- Add a collection of variables to end of list
- Parameters:
vars
- Variables to add to the list - collection of ElementSymbol
getValues
public java.util.List getValues()
- Returns a list of values to insert
to be inserted.
- Returns:
- List of
Expression
s
setValues
public void setValues(java.util.List values)
- Sets the values to be inserted.
- Parameters:
values
- List of Expression
s
setVariables
public void setVariables(java.util.Collection<ElementSymbol> vars)
- Set a collection of variables that replace the existing variables
- Parameters:
vars
- Variables to be set on this object (ElementSymbols)
addValue
public void addValue(Expression value)
- Adds a value to the list of values
- Parameters:
value
- Expression to be added to the list of values
setQueryExpression
public void setQueryExpression(QueryCommand query)
getQueryExpression
public QueryCommand getQueryExpression()
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.
- Parameters:
visitor
- Visitor being used
hashCode
public int hashCode()
- Get hashcode for command. WARNING: This hash code relies on the hash codes of the
Group, variables. If the command changes, it's hash code will change and
it can be lost from collections. Hash code is only valid after command has been
completely constructed.
- Overrides:
hashCode
in class java.lang.Object
- Returns:
- Hash code for object
equals
public boolean equals(java.lang.Object obj)
- Compare two Insert commands for equality. Will only evaluate to equal if
they are IDENTICAL: group is equal, value is equal and variables are equal.
- Overrides:
equals
in class java.lang.Object
- Parameters:
obj
- Other object
- Returns:
- True if equal
getProcedureParameters
public java.util.LinkedHashMap<ElementSymbol,Expression> getProcedureParameters()
- Specified by:
getProcedureParameters
in class ProcedureContainer
- Since:
- 5.0
- See Also:
org.teiid.query.sql.lang.ProcedureContainer#getParameters()
clone
public java.lang.Object clone()
- Return a deep copy of this Insert.
- Specified by:
clone
in interface LanguageObject
- Specified by:
clone
in class Command
- Returns:
- Deep copy of Insert
getProjectedSymbols
public java.util.List getProjectedSymbols()
- Get the ordered list of all elements returned by this query. These elements
may be ElementSymbols or ExpressionSymbols but in all cases each represents a
single column.
- Specified by:
getProjectedSymbols
in class Command
- Returns:
- Ordered list of SingleElementSymbol
areResultsCachable
public boolean areResultsCachable()
- Description copied from class:
Command
- Whether the results are cachable.
- Specified by:
areResultsCachable
in class Command
- Returns:
- True if the results are cachable; false otherwise.
- See Also:
Command.areResultsCachable()
setTupleSource
public void setTupleSource(TupleSource tupleSource)
getTupleSource
public TupleSource getTupleSource()
Copyright © 2010. All Rights Reserved.