org.teiid.query.sql.lang
Class Update
java.lang.Object
org.teiid.query.sql.lang.Command
org.teiid.query.sql.lang.ProcedureContainer
org.teiid.query.sql.lang.TranslatableProcedureContainer
org.teiid.query.sql.lang.Update
- All Implemented Interfaces:
- java.lang.Cloneable, LanguageObject
public class Update
- extends TranslatableProcedureContainer
Represents a SQL Update statement of the form:
"UPDATE SET = , ... [WHERE ]".
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 |
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 |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Update
public Update()
- Constructs a default instance of this class.
Update
public Update(GroupSymbol group,
SetClauseList changeList)
- Construct with group and change list
- Parameters:
group
- Group to by updatedchangeList
- List of CompareCriteria that represent Element->expression updates
Update
public Update(GroupSymbol group,
SetClauseList changeList,
Criteria criteria)
- Construct with group, change list, and criteria
- Parameters:
group
- DataGroupID that represents the group being updatedList
- of changeCriteria that represent Element->value pairingscriteria
- Criteria that defines what rows get updated
getType
public int getType()
- Return type of command.
- Specified by:
getType
in class Command
- Returns:
- TYPE_UPDATE
getGroup
public GroupSymbol getGroup()
- Returns the group being updated
- Specified by:
getGroup
in class ProcedureContainer
- Returns:
- Group being updated
setGroup
public void setGroup(GroupSymbol group)
- Set the group being updated
- Parameters:
group
- Group being updated
setChangeList
public void setChangeList(SetClauseList changeList)
- Set the list of CompareCriteria representing updates being made
- Parameters:
changeList
- List of CompareCriteria
getChangeList
public SetClauseList getChangeList()
- Return the list of CompareCriteria representing updates being made
- Returns:
- List of CompareCriteria
addChange
public void addChange(ElementSymbol id,
Expression value)
- Add change to change list - a change is represented by a CompareCriteria
internally but can be added here as an element and an expression
- Parameters:
id
- Element to be changedvalue
- Expression, often a value, being set
getCriteria
public Criteria getCriteria()
- Returns the criteria object for this command, may be null
- Specified by:
getCriteria
in class TranslatableProcedureContainer
- Returns:
- Criteria, may be null
setCriteria
public void setCriteria(Criteria criteria)
- Set the criteria for this Update command
- Parameters:
criteria
- Criteria to be associated with this command
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, changeList and Criteria clause. 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
toString
public java.lang.String toString()
- Returns a string representation of an instance of this class.
- Overrides:
toString
in class Command
- Returns:
- String representation of object
equals
public boolean equals(java.lang.Object obj)
- Compare two update commands for equality. Will only evaluate to equal if
they are IDENTICAL: group is equal, changeList contains same compareCriteria, criteria are in
the same exact structure.
- Overrides:
equals
in class java.lang.Object
- Parameters:
obj
- Other object
- Returns:
- True if equal
clone
public java.lang.Object clone()
- Return a copy of this Update.
- Specified by:
clone
in interface LanguageObject
- Specified by:
clone
in class Command
- Returns:
- Deep clone
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()
getProcedureParameters
public java.util.LinkedHashMap<ElementSymbol,Expression> getProcedureParameters()
- Specified by:
getProcedureParameters
in class ProcedureContainer
- Since:
- 5.0
- See Also:
ProcedureContainer.getProcedureParameters()
Copyright © 2010. All Rights Reserved.