org.axiondb.engine.commands
Class BaseAxionCommand

java.lang.Object
  extended by org.axiondb.engine.commands.BaseAxionCommand
All Implemented Interfaces:
AxionCommand
Direct Known Subclasses:
AlterTableCommand, CheckFileStateCommand, ChildTableUpdater, ConstraintCommand, CreateCommand, DefragCommand, DropCommand, InsertCommand, InsertIntoClause, RemountCommand, SelectCommand, ShutdownCommand, TruncateCommand

public abstract class BaseAxionCommand
extends Object
implements AxionCommand

Abstract base AxionCommandimplementation.

Version:
$Revision: 1.37 $ $Date: 2005/12/22 09:02:29 $

Constructor Summary
BaseAxionCommand()
           
 
Method Summary
protected  void assertNotReadOnly(Database db)
          Throws an AxionExceptionif the given Databaseis read-only.
protected  Object attemptToConvertValue(Object val, DataType type, ColumnIdentifier colid)
           
 void bindAll(Object[] vals)
          Sets the values of all bind variable within this command.
protected  void buildBindVariables()
           
 void clearBindings()
          Clears all bind variables within this command.
protected  void createResolveSelectableVisitor(Database db)
           
 AxionResultSet executeQuery(Database db, boolean isReadOnly)
          Execute an SQL statement that returns a single ResultSet object with the given read-only state.
protected  Iterator getBindVariableIterator()
          Returns an Iteratorover all my BindVariables, in the proper order.
protected  Iterator getBindVariableIterator(Selectable sel)
           
 List getBindVariables()
           
protected  FindBindVariableVisitor getBindVariableVisitor()
           
protected  List getColIdentifierList(Table table, TableIdentifier tid)
           
protected  int getCommitSize(Database db)
           
 int getEffectedRowCount()
          Returns the last row count generated by AxionCommand.execute(org.axiondb.Database) or AxionCommand.executeUpdate(org.axiondb.Database).
 ResultSet getResultSet()
          Returns the last ResultSet generated by AxionCommand.execute(org.axiondb.Database) or AxionCommand.executeQuery(org.axiondb.Database).
protected  RowIterator getRowIterator(Database db, TableIdentifier tid, Table table, Selectable whereNode, boolean readOnly, RowDecorator dec)
           
protected  RowDecorator makeRowDecorator(Table table)
           
protected  void populateDefaultValues(Database db, Table table, TableIdentifier tableId, RowDecorator dec)
           
protected  boolean populateSequenceColumns(Database db, Table table, Row row)
           
protected  void resolveGeneratedColumns(Table table, TableIdentifier tableId, List cols)
           
protected  void resolveGeneratedColumns(Table table, TableIdentifier tableId, List cols, boolean useDefaultValues)
           
protected  Selectable resolveSelectable(Selectable sel, Database db, List selected, TableIdentifier[] tables)
           
protected  Selectable resolveSelectable(Selectable sel, Database db, TableIdentifier[] tables)
           
protected  void resolveSelectableList(List list, Database db, TableIdentifier table)
           
protected  void resolveSelectableList(List list, Database db, TableIdentifier[] tables)
           
protected  void setBindVariableVisitor(FindBindVariableVisitor visitor)
           
protected  void setDeferAllConstraintIfRequired(Table table)
           
protected  void setEffectedRowCount(int count)
          If sublasses return a number of rows effected, then upon execution, they should set that number here so it can support AxionCommand.execute(org.axiondb.Database)
protected  void setResultSet(ResultSet rset)
          If subclasses create a AxionResultSetupon execution, they should set it here so that they can support AxionCommand.execute(org.axiondb.Database).
protected  void updateGeneratedValues(Database db, Table table, TableIdentifier tableId, Row row)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axiondb.AxionCommand
execute, executeQuery, executeUpdate
 

Constructor Detail

BaseAxionCommand

public BaseAxionCommand()
Method Detail

bindAll

public void bindAll(Object[] vals)
             throws AxionException
Sets the values of all bind variable within this command.

Specified by:
bindAll in interface AxionCommand
Parameters:
index - the one-based index of the variable
value - the value to bind the variable to
Throws:
AxionException

clearBindings

public void clearBindings()
                   throws AxionException
Clears all bind variables within this command.

Specified by:
clearBindings in interface AxionCommand
Throws:
AxionException

executeQuery

public AxionResultSet executeQuery(Database db,
                                   boolean isReadOnly)
                            throws AxionException
Description copied from interface: AxionCommand
Execute an SQL statement that returns a single ResultSet object with the given read-only state.

Specified by:
executeQuery in interface AxionCommand
Parameters:
db - Database in which query will be executed
isReadOnly - true if statement is read-only, false otherwise
Returns:
the generated ResultSet
Throws:
AxionException

getBindVariables

public List getBindVariables()
Specified by:
getBindVariables in interface AxionCommand

getEffectedRowCount

public final int getEffectedRowCount()
Description copied from interface: AxionCommand
Returns the last row count generated by AxionCommand.execute(org.axiondb.Database) or AxionCommand.executeUpdate(org.axiondb.Database).

Specified by:
getEffectedRowCount in interface AxionCommand

getResultSet

public final ResultSet getResultSet()
Description copied from interface: AxionCommand
Returns the last ResultSet generated by AxionCommand.execute(org.axiondb.Database) or AxionCommand.executeQuery(org.axiondb.Database).

Specified by:
getResultSet in interface AxionCommand

assertNotReadOnly

protected void assertNotReadOnly(Database db)
                          throws AxionException
Throws an AxionExceptionif the given Databaseis read-only.

Throws:
AxionException

attemptToConvertValue

protected Object attemptToConvertValue(Object val,
                                       DataType type,
                                       ColumnIdentifier colid)
                                throws AxionException
Throws:
AxionException

buildBindVariables

protected void buildBindVariables()

createResolveSelectableVisitor

protected final void createResolveSelectableVisitor(Database db)

getBindVariableIterator

protected Iterator getBindVariableIterator()
Returns an Iteratorover all my BindVariables, in the proper order. Default impl returns empty iterator.


getBindVariableIterator

protected Iterator getBindVariableIterator(Selectable sel)

getBindVariableVisitor

protected final FindBindVariableVisitor getBindVariableVisitor()

getColIdentifierList

protected List getColIdentifierList(Table table,
                                    TableIdentifier tid)
                             throws AxionException
Throws:
AxionException

getCommitSize

protected int getCommitSize(Database db)

getRowIterator

protected RowIterator getRowIterator(Database db,
                                     TableIdentifier tid,
                                     Table table,
                                     Selectable whereNode,
                                     boolean readOnly,
                                     RowDecorator dec)
                              throws AxionException
Throws:
AxionException

makeRowDecorator

protected final RowDecorator makeRowDecorator(Table table)

populateDefaultValues

protected void populateDefaultValues(Database db,
                                     Table table,
                                     TableIdentifier tableId,
                                     RowDecorator dec)
                              throws AxionException
Throws:
AxionException

populateSequenceColumns

protected boolean populateSequenceColumns(Database db,
                                          Table table,
                                          Row row)
                                   throws AxionException
Throws:
AxionException

resolveGeneratedColumns

protected void resolveGeneratedColumns(Table table,
                                       TableIdentifier tableId,
                                       List cols)
                                throws AxionException
Throws:
AxionException

resolveGeneratedColumns

protected void resolveGeneratedColumns(Table table,
                                       TableIdentifier tableId,
                                       List cols,
                                       boolean useDefaultValues)
                                throws AxionException
Throws:
AxionException

resolveSelectable

protected Selectable resolveSelectable(Selectable sel,
                                       Database db,
                                       List selected,
                                       TableIdentifier[] tables)
                                throws AxionException
Throws:
AxionException

resolveSelectable

protected Selectable resolveSelectable(Selectable sel,
                                       Database db,
                                       TableIdentifier[] tables)
                                throws AxionException
Throws:
AxionException

resolveSelectableList

protected void resolveSelectableList(List list,
                                     Database db,
                                     TableIdentifier table)
                              throws AxionException
Throws:
AxionException

resolveSelectableList

protected void resolveSelectableList(List list,
                                     Database db,
                                     TableIdentifier[] tables)
                              throws AxionException
Throws:
AxionException

setBindVariableVisitor

protected final void setBindVariableVisitor(FindBindVariableVisitor visitor)

setDeferAllConstraintIfRequired

protected void setDeferAllConstraintIfRequired(Table table)

setEffectedRowCount

protected final void setEffectedRowCount(int count)
If sublasses return a number of rows effected, then upon execution, they should set that number here so it can support AxionCommand.execute(org.axiondb.Database)


setResultSet

protected final void setResultSet(ResultSet rset)
If subclasses create a AxionResultSetupon execution, they should set it here so that they can support AxionCommand.execute(org.axiondb.Database).

See Also:
getResultSet()

updateGeneratedValues

protected void updateGeneratedValues(Database db,
                                     Table table,
                                     TableIdentifier tableId,
                                     Row row)
                              throws AxionException
Throws:
AxionException