org.axiondb.engine.commands
Class UpsertCommand

java.lang.Object
  extended by org.axiondb.engine.commands.BaseAxionCommand
      extended by org.axiondb.engine.commands.ChildTableUpdater
          extended by org.axiondb.engine.commands.UpsertCommand
All Implemented Interfaces:
AxionCommand

public class UpsertCommand
extends ChildTableUpdater

An UPSERT or MERGE command.

Version:
$Revision: 1.35 $ $Date: 2006/01/10 21:02:37 $

Constructor Summary
UpsertCommand()
           
 
Method Summary
 void addUpdateColumn(ColumnIdentifier col)
           
 void addUpdateValue(Selectable val)
           
protected  void buildBindVariables()
           
 boolean execute(Database database)
          Executes an SQL statement that may return multiple results.
 AxionResultSet executeQuery(Database database)
          Unsupported, use executeUpdate(org.axiondb.Database)instead.
 int executeUpdate(Database db)
          Executes an SQL that may add, delete or modify zero or more rows within the database, such as an INSERT, UPDATE or DELETE statement.
 Selectable getCondition()
           
 org.axiondb.engine.commands.UpsertCommand.ExceptionWhenClause getExceptionWhenClause()
           
 Iterator getInsertValueIterator()
           
 Iterator getUpdateValueIterator()
           
 SubSelectCommand getUsingSubSelectCommand()
           
protected  RowDecorator makeTargetRowDecorator()
           
protected  void resolve(Database db)
           
 void setColumnsForInsert(List columnForInsert)
           
 void setCondition(Selectable condition)
           
 void setExceptionWhenClause(DMLWhenClause w, TableIdentifier t, List cols, List vals)
           
 void setSelectCommand(SubSelectCommand command)
           
 void setSourceTable(TableIdentifier table)
           
 void setTargetTable(TableIdentifier table)
           
 void setUsingSubSelectAlias(String alias)
           
 void setUsingSubSelectCommand(SubSelectCommand command)
           
 void setValuesForInsert(List valuesForInsert)
           
 
Methods inherited from class org.axiondb.engine.commands.ChildTableUpdater
deleteOrSetNullChildRows, deleteOrSetNullChildRows, updateOrSetNullChildRows, updateOrSetNullChildRows
 
Methods inherited from class org.axiondb.engine.commands.BaseAxionCommand
assertNotReadOnly, attemptToConvertValue, bindAll, clearBindings, createResolveSelectableVisitor, executeQuery, getBindVariableIterator, getBindVariableIterator, getBindVariables, getBindVariableVisitor, getColIdentifierList, getCommitSize, getEffectedRowCount, getResultSet, getRowIterator, makeRowDecorator, populateDefaultValues, populateSequenceColumns, resolveGeneratedColumns, resolveGeneratedColumns, resolveSelectable, resolveSelectable, resolveSelectableList, resolveSelectableList, setBindVariableVisitor, setDeferAllConstraintIfRequired, setEffectedRowCount, setResultSet, updateGeneratedValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpsertCommand

public UpsertCommand()
Method Detail

addUpdateColumn

public void addUpdateColumn(ColumnIdentifier col)

addUpdateValue

public void addUpdateValue(Selectable val)

execute

public boolean execute(Database database)
                throws AxionException
Description copied from interface: AxionCommand
Executes an SQL statement that may return multiple results.

Returns:
true if one or more ResultSets were generated, false otherwise
Throws:
AxionException
See Also:
Statement.execute(java.lang.String), PreparedStatement.execute()

executeQuery

public AxionResultSet executeQuery(Database database)
                            throws AxionException
Unsupported, use executeUpdate(org.axiondb.Database)instead.

Returns:
the generated ResultSet
Throws:
UnsupportedOperationException
AxionException
See Also:
Statement.executeQuery(java.lang.String), PreparedStatement.executeQuery()

executeUpdate

public int executeUpdate(Database db)
                  throws AxionException
Description copied from interface: AxionCommand
Executes an SQL that may add, delete or modify zero or more rows within the database, such as an INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed via this method.

Returns:
the number of rows modified
Throws:
AxionException
See Also:
Statement.executeUpdate(java.lang.String), PreparedStatement.executeUpdate()

setColumnsForInsert

public void setColumnsForInsert(List columnForInsert)

setCondition

public void setCondition(Selectable condition)

getCondition

public Selectable getCondition()

setExceptionWhenClause

public void setExceptionWhenClause(DMLWhenClause w,
                                   TableIdentifier t,
                                   List cols,
                                   List vals)

getExceptionWhenClause

public org.axiondb.engine.commands.UpsertCommand.ExceptionWhenClause getExceptionWhenClause()

setSelectCommand

public void setSelectCommand(SubSelectCommand command)

setSourceTable

public void setSourceTable(TableIdentifier table)

setTargetTable

public void setTargetTable(TableIdentifier table)

setUsingSubSelectAlias

public void setUsingSubSelectAlias(String alias)

setUsingSubSelectCommand

public void setUsingSubSelectCommand(SubSelectCommand command)

getUsingSubSelectCommand

public SubSelectCommand getUsingSubSelectCommand()

setValuesForInsert

public void setValuesForInsert(List valuesForInsert)

buildBindVariables

protected void buildBindVariables()
Overrides:
buildBindVariables in class BaseAxionCommand

getInsertValueIterator

public Iterator getInsertValueIterator()

getUpdateValueIterator

public Iterator getUpdateValueIterator()

resolve

protected void resolve(Database db)
                throws AxionException
Throws:
AxionException

makeTargetRowDecorator

protected final RowDecorator makeTargetRowDecorator()