All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tc.database.DatabaseQuery

java.lang.Object
   |
   +----tc.database.DatabaseQuery

public abstract class DatabaseQuery
extends Object
DatabaseQuery is a common interface for all database queries. It defines the methods which a database query must implement so that DatabaseManager can execute it.

Version:
0.30, 1998/04/01
Author:
FRED development team, Antti Viljamaa
See Also:
DatabaseManager

Variable Index

 o databaseManager
The database manager that executes this query.
 o parameters
The possible parameters needed to execute the query.
 o result
The query result.

Constructor Index

 o DatabaseQuery()

Method Index

 o calculate(QueryDataSet)
Finalizes the query by possible gathering information from the given datset (that is formed based on the SQL query that getSQLClause returned) or modifying the dataset.
 o doValidationCheck()
DatabaseManager always calls this method before the actual calculation.
 o getDatabaseManager()
Gets the DatabaseManager of this query.
 o getParameters()
Gets the parameters needed to execute the query.
 o getResult()
Returns the query result.
 o getSQLClause()
This method must return the SQL clause that is used to create a QueryDataSet for this query.
 o isWriteQuery()
Determines if this query is a write query (intends to modify the data in the database).
 o setDatabaseManager(DatabaseManager)
Sets a DatabaseManager for this query.
 o setParameters(Object)
Sets the possible parameters needed to execute the query.
 o setResult(Object)
Sets the query result.

Variables

 o databaseManager
 private DatabaseManager databaseManager
The database manager that executes this query. The query can use this reference when implementing other methods because the reference is set before any other methods are called.

 o parameters
 private Object parameters
The possible parameters needed to execute the query.

 o result
 private Object result
The query result.

Constructors

 o DatabaseQuery
 public DatabaseQuery()

Methods

 o calculate
 public abstract void calculate(QueryDataSet dataset) throws DataSetException, ValidationException
Finalizes the query by possible gathering information from the given datset (that is formed based on the SQL query that getSQLClause returned) or modifying the dataset.

If this query is a read query this method should create the result object that is retuned in getResult. Otherwise, if this query is a write query this method should modify or remove the wanted rows in the dataset. The dataset includes proper methods for iterating and examining it.

See Also:
QueryDataSet, getResult
 o getDatabaseManager
 public DatabaseManager getDatabaseManager()
Gets the DatabaseManager of this query.

 o doValidationCheck
 public void doValidationCheck() throws ValidationException
DatabaseManager always calls this method before the actual calculation. In this method a database query can perform an additional check which ensures that the query can be performed. If the check fails, the method must throw a subclass of ValidationException.

 o getResult
 public Object getResult()
Returns the query result.

 o getSQLClause
 public abstract String getSQLClause()
This method must return the SQL clause that is used to create a QueryDataSet for this query. The create dataset is fetched as a parameter for the calculate method.

Returns:
String A string representing the query.
See Also:
QueryDataSet, calculate
 o isWriteQuery
 public abstract boolean isWriteQuery()
Determines if this query is a write query (intends to modify the data in the database).

 o setDatabaseManager
 public void setDatabaseManager(DatabaseManager dbm)
Sets a DatabaseManager for this query.

 o setResult
 public void setResult(Object res)
Sets the query result.

 o getParameters
 protected Object getParameters()
Gets the parameters needed to execute the query.

 o setParameters
 protected void setParameters(Object p)
Sets the possible parameters needed to execute the query.


All Packages  Class Hierarchy  This Package  Previous  Next  Index