uk.co.agena.minerva.model.querymodel
Class QueryInstance
java.lang.Object
uk.co.agena.minerva.model.querymodel.QueryInstance
- Direct Known Subclasses:
- UpdateInstance
public class QueryInstance
- extends java.lang.Object
A QueryInstance is an instance of a DatabaseQuery. DatabaseQueries
contain only general information about a query. This class
represents the instantiation of a query with parameters and results.
We use a simple substitution of "?"s in query strings to instantiate
queries. This would be better performed using PreparedStatements.
However not all data sources will support this and database efficiency
is not currently a concern.
A parameter can also take the form: "? [query name] [row] [col]", where
[query name] is the name of another QueryInstance that must be run
before this QueryInstance. The row and column refer to the row and
column of the results of the parent query. The row can also take the
value "*" to indicate "all rows" of parent. In this case, the query will
execute all parents in advance and then create a series of child
instances, with each one taking a row from the parent as a parameter.
Only one parameter can include a * row wildcard.
There can be many instances of a query, all with different parameters
and results.
- Author:
- hearty
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
QueryInstance
public QueryInstance(DatabaseQuery query,
java.lang.String name,
java.lang.Object[] parameters)
load
public static QueryInstance load(XmlHelper helper,
DatabaseQuery dq)
execute
public java.lang.String execute()
- Executes the query string and stores the results in "result".
- Returns:
columnNameToNumber
public int columnNameToNumber(java.lang.String colName)
getResult
public java.lang.Object[][] getResult()
getChildResult
public java.lang.Object getChildResult(int childNumber,
int row,
int col)
getResult
public java.lang.Object getResult(int row,
int col)
getParameters
public uk.co.agena.minerva.model.querymodel.QueryInstance.QueryParameter[] getParameters()
getName
public java.lang.String getName()
setName
public void setName(java.lang.String name)
getQuery
public DatabaseQuery getQuery()
setQuery
public void setQuery(DatabaseQuery query)
getColumnNames
public java.lang.Object[] getColumnNames()
getQueryString
public java.lang.String getQueryString()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
isHasMultipleChildren
public boolean isHasMultipleChildren()
getNumberChildren
public int getNumberChildren()
getChildQueries
public QueryInstance[] getChildQueries()
Copyright © 2006 Agena Ltd. All Rights Reserved.