com.metamatrix.query.sql.lang
Class BulkInsert

java.lang.Object
  extended by com.metamatrix.query.sql.lang.Command
      extended by com.metamatrix.query.sql.lang.ProcedureContainer
          extended by com.metamatrix.query.sql.lang.PreparedBatchUpdate
              extended by com.metamatrix.query.sql.lang.Insert
                  extended by com.metamatrix.query.sql.lang.BulkInsert
All Implemented Interfaces:
CommandContainer, LanguageObject, java.io.Serializable, java.lang.Cloneable

public class BulkInsert
extends Insert

Bulk insert is variation of Insert command, where a single table is being inserted with multiple values. The purpose of this class from Insert is to minimize the memory footprint and avoid multiple planning and performace.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.metamatrix.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, TYPE_XQUERY
 
Constructor Summary
BulkInsert(GroupSymbol group, java.util.List variables)
          Default ctor
BulkInsert(GroupSymbol group, java.util.List variables, java.util.List rows)
          Default ctor
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 void addValue(Expression value)
          Adds a value to the list of values
 java.lang.Object clone()
          Return a deep copy of this Insert.
 boolean equals(java.lang.Object obj)
          Compare two Insert commands for equality.
 java.util.List getRows()
          Get the list of rows of column values.
 java.util.List getValues()
          Returns a list of values to insert to be inserted.
 void setRows(java.util.List rows)
          Get the list of rows of column values.
 void setValues(java.util.List values)
          Sets the values to be inserted.
 int updatingModelCount(QueryMetadataInterface metadata)
          Return the number of updates on physical sources by this command.
 
Methods inherited from class com.metamatrix.query.sql.lang.Insert
addVariable, addVariables, areResultsCachable, getGroup, getProcedureParameters, getProjectedSymbols, getQueryExpression, getType, getVariables, hashCode, setGroup, setQueryExpression, setVariables
 
Methods inherited from class com.metamatrix.query.sql.lang.PreparedBatchUpdate
getParameterReferences, isBatchedUpdate, setParameterReferences, setUpdatingModelCount
 
Methods inherited from class com.metamatrix.query.sql.lang.ProcedureContainer
copyMetadataState, getContainedCommands, getSubCommand, getUpdateCount, setSubCommand, setUpdateCount
 
Methods inherited from class com.metamatrix.query.sql.lang.Command
addExternalGroupsToContext, addExternalGroupToContext, getAllExternalGroups, getExternalGroupContexts, getOption, getSubCommands, getSubCommandsUpdatingModelCount, getSubCommandsUpdatingModelCount, getTemporaryMetadata, getUpdateCommandSymbol, getUpdatesCommandSymbol, getVariableValues, getVirtualGroup, isResolved, printCommandTree, printCommandTree, pushNewResolvingContext, setExternalGroupContexts, setIsResolved, setOption, setTemporaryMetadata, setVariableValues, setVirtualGroup, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BulkInsert

public BulkInsert(GroupSymbol group,
                  java.util.List variables,
                  java.util.List rows)
Default ctor

Parameters:
group - - Group Name
variables - - Column Names

BulkInsert

public BulkInsert(GroupSymbol group,
                  java.util.List variables)
Default ctor

Parameters:
group - - Group Name
variables - - Column Names
Method Detail

getRows

public java.util.List getRows()
Get the list of rows of column values.

Returns:
List(row)-->list of column values; never null

setRows

public void setRows(java.util.List rows)
Get the list of rows of column values. (row)-->list of column values


addValue

public void addValue(Expression value)
Description copied from class: Insert
Adds a value to the list of values

Overrides:
addValue in class Insert
Parameters:
value - Expression to be added to the list of values
See Also:
Insert.addValue(com.metamatrix.query.sql.symbol.Expression)

getValues

public java.util.List getValues()
Description copied from class: Insert
Returns a list of values to insert to be inserted.

Overrides:
getValues in class Insert
Returns:
List of Expressions
See Also:
Insert.getValues()

setValues

public void setValues(java.util.List values)
Description copied from class: Insert
Sets the values to be inserted.

Overrides:
setValues in class Insert
Parameters:
values - List of Expressions
See Also:
Insert.setValues(java.util.List)

clone

public java.lang.Object clone()
Description copied from class: Insert
Return a deep copy of this Insert.

Specified by:
clone in interface LanguageObject
Overrides:
clone in class Insert
Returns:
Deep copy of Insert
See Also:
Object.clone()

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Insert
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 Insert
Parameters:
obj - Other object
Returns:
True if equal
See Also:
Object.equals(java.lang.Object)

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 interface LanguageObject
Overrides:
acceptVisitor in class Insert
Parameters:
visitor - Visitor being used

updatingModelCount

public int updatingModelCount(QueryMetadataInterface metadata)
                       throws MetaMatrixComponentException
Description copied from class: Command
Return the number of updates on physical sources by this command.

Overrides:
updatingModelCount in class PreparedBatchUpdate
Parameters:
metadata - QueryMetadataInterface
Returns:
The number of updates on physical sources by this command.
Throws:
MetaMatrixComponentException
See Also:
PreparedBatchUpdate.updatingModelCount(com.metamatrix.query.metadata.QueryMetadataInterface)


Copyright © 2009. All Rights Reserved.