com.mckoi.database
Class DatabaseQueryContext

java.lang.Object
  extended by com.mckoi.database.AbstractQueryContext
      extended by com.mckoi.database.DatabaseQueryContext
All Implemented Interfaces:
QueryContext

public class DatabaseQueryContext
extends AbstractQueryContext

An implementation of a QueryContext based on a DatabaseConnection object.

Author:
Tobias Downer

Constructor Summary
DatabaseQueryContext(DatabaseConnection database)
          Constructs the QueryContext.
 
Method Summary
 QueryPlanNode createViewQueryPlanNode(TableName name)
          Creates a QueryPlanNode for the view with the given name.
 long currentSequenceValue(java.lang.String name)
          Returns the current sequence value returned for the given sequence generator within the connection defined by this context.
 Database getDatabase()
          Returns the Database object that this context is a child of.
 DataTableDef getDataTableDef(TableName name)
          Returns a DataTableDef for the given table name.
 FunctionLookup getFunctionLookup()
          Returns the system FunctionLookup object.
 GrantManager getGrantManager()
          Returns the GrantManager object that is used to determine grant information for the database.
 TransactionSystem getSystem()
          Returns a TransactionSystem object that is used to determine information about the transactional system.
 DataTable getTable(TableName name)
          Returns a DataTable from the database with the given table name.
 java.lang.String getUserName()
          Returns the user name of the connection.
 long nextSequenceValue(java.lang.String name)
          Increments the sequence generator and returns the next unique key.
 void setSequenceValue(java.lang.String name, long value)
          Sets the current sequence value for the given sequence generator.
 
Methods inherited from class com.mckoi.database.AbstractQueryContext
addMarkedTable, clearCache, getCachedNode, getMarkedTable, putCachedNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseQueryContext

public DatabaseQueryContext(DatabaseConnection database)
Constructs the QueryContext.

Method Detail

getDatabase

public Database getDatabase()
Returns the Database object that this context is a child of.


getSystem

public TransactionSystem getSystem()
Returns a TransactionSystem object that is used to determine information about the transactional system.


getFunctionLookup

public FunctionLookup getFunctionLookup()
Returns the system FunctionLookup object.


getGrantManager

public GrantManager getGrantManager()
Returns the GrantManager object that is used to determine grant information for the database.


getTable

public DataTable getTable(TableName name)
Returns a DataTable from the database with the given table name.


getDataTableDef

public DataTableDef getDataTableDef(TableName name)
Returns a DataTableDef for the given table name.


createViewQueryPlanNode

public QueryPlanNode createViewQueryPlanNode(TableName name)
Creates a QueryPlanNode for the view with the given name.


nextSequenceValue

public long nextSequenceValue(java.lang.String name)
Increments the sequence generator and returns the next unique key.


currentSequenceValue

public long currentSequenceValue(java.lang.String name)
Returns the current sequence value returned for the given sequence generator within the connection defined by this context. If a value was not returned for this connection then a statement exception is generated.


setSequenceValue

public void setSequenceValue(java.lang.String name,
                             long value)
Sets the current sequence value for the given sequence generator.


getUserName

public java.lang.String getUserName()
Returns the user name of the connection.