| java.lang.Object org.makumba.list.engine.ComposedQuery
All known Subclasses: org.makumba.list.engine.ComposedSubquery, org.makumba.list.engine.Evaluator,
ComposedQuery | public class ComposedQuery (Code) | | An OQL query composed from various elements found in script pages. It can be enriched when a new element is found. It
has a prepared Qyuery correspondent in a makumba database It may be based on a super query.
author: Cristian Bogdan version: $Id: ComposedQuery.java 2150 2007-11-22 17:16:18Z cristian_bogdan $ |
Inner Class :public static interface Evaluator | |
Method Summary | |
Integer | addProjection(String expr) | public void | addProjection(Object o) allows to directly set a projection. | protected void | addSubquery(ComposedSubquery q) Adds a subquery to this query. | public synchronized void | analyze() | String | checkExpr(String str) Checks the orderBy or groupBy expressions to see if they are already selected, if not adds a projection. | public Object | checkExprSetOrNullable(String expr) | public Object | checkLabelSetOrNullable(String referenceSequence) | String | checkProjection(String expr) Checks if a projection exists, and if not, adds it. | public Integer | checkProjectionInteger(String expr) Checks if a projection exists, and if not, adds it. | public static String | columnName(Integer n) | protected String | computeQuery(String derivedSections, boolean typeAnalysisOnly) | public Grouper | execute(QueryProvider qep, Map args, Evaluator v, int offset, int limit) | public String | getFromSection() | public DataDefinition | getLabelType(String s) | public String | getProjectionAt(int n) | public DataDefinition | getResultType() | public void | init() Initializes the object. | protected void | initKeysets() Initializes the keysets. | static boolean | isMakId(char c) | protected void | prependFromToKeyset() Adds all keys from the FROM section to the keyset, and their labels to the keyLabels. |
FROM | final public static int FROM(Code) | | Standard index for the FROM query section
|
GROUPBY | final public static int GROUPBY(Code) | | Standard index for the GROUPBY query section
|
ORDERBY | final public static int ORDERBY(Code) | | Standard index for the ORDERBY query section
|
VARFROM | final public static int VARFROM(Code) | | Standard index for the VARFROM query section
|
WHERE | final public static int WHERE(Code) | | Standard index for the WHERE query section
|
derivedSections | String[] derivedSections(Code) | | Derived section texts, made from the sections of this query and the sections of its superqueries
|
empty | static Vector empty(Code) | | A Vector containing and empty vector. Used for empty keysets
|
keyset | Vector<Integer> keyset(Code) | | The keyset defining the primary key for this query. Normally the primary key is made of the keys declared in
FROM, in this query and all the parent queries. Keys are kept as integers (indexes)
|
previousKeyset | Vector previousKeyset(Code) | | The keyset of all the parent queries
|
sections | String[] sections(Code) | | Section texts, encoded with the standard indexes
|
ComposedQuery | public ComposedQuery(String[] sections, String queryLanguage)(Code) | | Default constructor
Parameters: sections - Parameters: usesHQL - |
addProjection | Integer addProjection(String expr)(Code) | | Adds a projection with the given expression
Parameters: expr - the expression to add The index at which the expression was added |
addSubquery | protected void addSubquery(ComposedSubquery q)(Code) | | Adds a subquery to this query. Makes it aware that it has subqueries at all. Makes it be able to announce its
subqueries about changes (this will be needed when unique=true will be possible)
Parameters: q - the subquery |
analyze | public synchronized void analyze()(Code) | | |
checkExpr | String checkExpr(String str)(Code) | | Checks the orderBy or groupBy expressions to see if they are already selected, if not adds a projection. Only
group by and order by labels.
Parameters: str - an orderBy or groupBy expression The checked expression, transformed according to the projections |
checkExprSetOrNullable | public Object checkExprSetOrNullable(String expr)(Code) | | Checks if an expression is valid, nullable or set
Parameters: expr - the expression The path to the null pointer (if the object is nullable), null otherwise |
checkLabelSetOrNullable | public Object checkLabelSetOrNullable(String referenceSequence)(Code) | | Checks if an id is nullable, and if so, return the path to the null pointer
Parameters: referenceSequence - a sequence like field1.field2.field3 The path to the null pointer (if the object is nullable), null otherwise |
checkProjection | String checkProjection(String expr)(Code) | | Checks if a projection exists, and if not, adds it.
Parameters: expr - the expression to add The column name of the projection |
checkProjectionInteger | public Integer checkProjectionInteger(String expr)(Code) | | Checks if a projection exists, and if not, adds it.
Parameters: expr - the expression to add The index of the added projection |
columnName | public static String columnName(Integer n)(Code) | | Gets the name of a column indicated by index
Parameters: n - the index of the column A String containing the name of the column, of the kind "colN" |
computeQuery | protected String computeQuery(String derivedSections, boolean typeAnalysisOnly)(Code) | | Computes the query from its sections
Parameters: derivedSections - the sections of this query Parameters: typeAnalysisOnly - indicates whether this is only a type analysis The computed OQL query |
execute | public Grouper execute(QueryProvider qep, Map args, Evaluator v, int offset, int limit) throws LogicException(Code) | | Executes the contained query in the given database
Parameters: qep - the database where the query should be ran Parameters: args - the arguments we may need during the execution Parameters: v - the evaluator evaluating the expressions Parameters: offset - at which iteration this query should start Parameters: limit - how many times should this query be ran throws: LogicException - |
getFromSection | public String getFromSection()(Code) | | Gets the FROM section
A String containing the FROM section of the query |
getLabelType | public DataDefinition getLabelType(String s)(Code) | | Gets the type of a given label
Parameters: s - the name of the label A DataDefinition corresponding to the type of the label |
getProjectionAt | public String getProjectionAt(int n)(Code) | | Gets a given projection
Parameters: n - the index of the projection A String containing the projection |
getResultType | public DataDefinition getResultType()(Code) | | Gets the type of the result
The DataDefinition corresponding to the type of the result |
init | public void init()(Code) | | Initializes the object. This is a template method
|
initKeysets | protected void initKeysets()(Code) | | Initializes the keysets. previousKeyset is "empty"
|
isMakId | static boolean isMakId(char c)(Code) | | Checks if a character can be part of a makumba identifier
Parameters: c - the character to check true if the character can be part of a makumba identifier, false otherwise |
prependFromToKeyset | protected void prependFromToKeyset()(Code) | | Adds all keys from the FROM section to the keyset, and their labels to the keyLabels. They are all added as
projections (this has to change)
|
|
|