org.axiondb.engine.commands
Class InsertCommand

java.lang.Object
  extended byorg.axiondb.engine.commands.BaseAxionCommand
      extended byorg.axiondb.engine.commands.InsertCommand
All Implemented Interfaces:
AxionCommand

public class InsertCommand
extends BaseAxionCommand

An INSERT statement.

Version:
$Revision: 1.44 $ $Date: 2004/09/09 23:47:43 $

Field Summary
static int WHEN_ALL
           
static int WHEN_FIRST
           
 
Constructor Summary
InsertCommand()
           
InsertCommand(TableIdentifier table)
           
InsertCommand(TableIdentifier table, ColumnIdentifier column, Selectable value)
           
InsertCommand(TableIdentifier table, List columns, AxionCommand subSelect)
           
InsertCommand(TableIdentifier table, List columns, List values)
           
InsertCommand(TableIdentifier table, List columns, SubSelectCommand subSelect)
           
 
Method Summary
 void addColumn(ColumnIdentifier col)
           
 void addInsertIntoClause(DMLWhenClause when, TableIdentifier table, List columns, List values)
           
 void addValue(Selectable val)
           
 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.
protected  Iterator getBindVariableIterator()
          Returns an Iteratorover all my BindVariables, in the proper order.
 Iterator getColumnIterator()
           
 org.axiondb.engine.commands.InsertCommand.ElseClause getElseClause()
           
 int getMultiTableEvaluationMode()
           
 TableIdentifier getTable()
           
 Iterator getValueIterator()
           
 boolean isInsertIntoListEmpty()
           
 void setElseClause(TableIdentifier table, List tableColumns, List tableValues)
           
 void setMultiTableEvaluationMode(int mode)
           
 void setSubSelect(SubSelectCommand select)
           
 
Methods inherited from class org.axiondb.engine.commands.BaseAxionCommand
appendBindVariables, assertNotReadOnly, attemptToConvertValue, bind, clearBindings, getEffectedRowCount, getResultSet, getRowIterator, getRowIterator, getTableForIdentifier, resolveSelectableList, resolveSelectableList, setEffectedRowCount, setResultSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHEN_ALL

public static final int WHEN_ALL
See Also:
Constant Field Values

WHEN_FIRST

public static final int WHEN_FIRST
See Also:
Constant Field Values
Constructor Detail

InsertCommand

public InsertCommand()

InsertCommand

public InsertCommand(TableIdentifier table)
Parameters:
table - The table in which to insert

InsertCommand

public InsertCommand(TableIdentifier table,
                     ColumnIdentifier column,
                     Selectable value)
Parameters:
table - The table in which to insert
column - a column to insert

InsertCommand

public InsertCommand(TableIdentifier table,
                     List columns,
                     AxionCommand subSelect)

InsertCommand

public InsertCommand(TableIdentifier table,
                     List columns,
                     SubSelectCommand subSelect)

InsertCommand

public InsertCommand(TableIdentifier table,
                     List columns,
                     List values)
Parameters:
table - The table in which to insert
columns - List of ColumnIdentifiers, which may be null
values - List of Objects, which may be null
Throws:
InvalidArgumentException - if columns.size() > 0 && columns.size() != values.size()
Method Detail

addColumn

public void addColumn(ColumnIdentifier col)

addInsertIntoClause

public void addInsertIntoClause(DMLWhenClause when,
                                TableIdentifier table,
                                List columns,
                                List values)

isInsertIntoListEmpty

public boolean isInsertIntoListEmpty()

addValue

public void addValue(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()

getColumnIterator

public Iterator getColumnIterator()

getElseClause

public org.axiondb.engine.commands.InsertCommand.ElseClause getElseClause()

getMultiTableEvaluationMode

public int getMultiTableEvaluationMode()

getTable

public TableIdentifier getTable()

getValueIterator

public Iterator getValueIterator()

setElseClause

public void setElseClause(TableIdentifier table,
                          List tableColumns,
                          List tableValues)

setMultiTableEvaluationMode

public void setMultiTableEvaluationMode(int mode)

setSubSelect

public void setSubSelect(SubSelectCommand select)

getBindVariableIterator

protected Iterator getBindVariableIterator()
Description copied from class: BaseAxionCommand
Returns an Iteratorover all my BindVariables, in the proper order. Default impl returns empty iterator.

Overrides:
getBindVariableIterator in class BaseAxionCommand