|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.makumba.list.engine.ComposedQuery
public class ComposedQuery
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.
Nested Class Summary | |
---|---|
static interface |
ComposedQuery.Evaluator
Interface for an Evaluator which can evaluate expressions |
Field Summary | |
---|---|
(package private) String[] |
derivedSections
Derived section texts, made from the sections of this query and the sections of its superqueries |
(package private) static Vector<Vector<Integer>> |
empty
A Vector containing an empty vector. |
static int |
FROM
Standard index for the FROM query section |
(package private) String |
fromAnalyzerOQL
|
static int |
GROUPBY
Standard index for the GROUPBY query section |
(package private) Vector<Integer> |
keyset
The keyset defining the primary key for this query. |
(package private) Vector<String> |
keysetLabels
The labels of the keyset |
static int |
ORDERBY
Standard index for the ORDERBY query section |
(package private) Vector<Vector<Integer>> |
previousKeyset
The keyset of all the parent queries |
(package private) Hashtable<String,Integer> |
projectionExpr
The expression associated to each projection |
(package private) Vector<String> |
projections
The projections made in this query |
QueryAnalysisProvider |
qep
|
(package private) String[] |
sections
Section texts, encoded with the standard indexes |
static int |
STATIC_WHERE
Standard index for the STATIC_CONDITION query section |
(package private) int |
subqueries
The subqueries of this query |
(package private) String |
typeAnalyzerOQL
|
static int |
VARFROM
Standard index for the VARFROM query section |
static int |
WHERE
Standard index for the WHERE query section |
Constructor Summary | |
---|---|
ComposedQuery(String[] sections,
String queryLanguage)
Default constructor |
Method Summary | |
---|---|
(package private) Integer |
addProjection(String expr)
Adds a projection with the given expression |
void |
addProjectionDirectly(String s)
allows to directly set a projection. |
protected void |
addSubquery(ComposedSubquery q)
Adds a subquery to this query. |
void |
analyze()
|
(package private) String |
checkExpr(String str)
Checks the orderBy or groupBy expressions to see if they are already selected, if not adds a projection. |
Object |
checkExprSetOrNullable(String expr)
|
(package private) String |
checkProjection(String expr)
Checks if a projection exists, and if not, adds it. |
Integer |
checkProjectionInteger(String expr)
Checks if a projection exists, and if not, adds it. |
static String |
columnName(Integer n)
Gets the name of a column indicated by index |
protected String |
computeQuery(String[] derivedSections,
boolean typeAnalysisOnly)
Computes the query from its sections |
Grouper |
execute(QueryProvider qep,
Map args,
ComposedQuery.Evaluator v,
int offset,
int limit)
Executes the contained query in the given database |
String |
getComputedQuery()
|
Map<String,DataDefinition> |
getFromLabelTypes()
Gets the types of the labels in the FROM section |
String |
getFromSection()
Gets the FROM section |
String |
getGroupBySection()
Gets the GROUP BY section |
DataDefinition |
getLabelType(String s)
Gets the type of a given label |
String |
getProjectionAt(int n)
Gets a given projection |
Vector<String> |
getProjections()
Gets the projections of this query |
DataDefinition |
getProjectionTypes()
Gets the type of the fields between SELECT and FROM |
DataDefinition |
getResultType()
Gets the type of the result |
String |
getTypeAnalyzerQuery()
Gets the query string. |
void |
init()
Initializes the object. |
protected void |
initKeysets()
Initializes the keysets. previousKeyset is "empty" |
protected void |
prependFromToKeyset()
Adds all keys from the FROM section to the keyset, and their labels to the keyLabels. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public QueryAnalysisProvider qep
int subqueries
Vector<String> projections
Hashtable<String,Integer> projectionExpr
public static final int FROM
public static final int WHERE
public static final int GROUPBY
public static final int ORDERBY
public static final int VARFROM
public static final int STATIC_WHERE
String[] sections
String[] derivedSections
String typeAnalyzerOQL
String fromAnalyzerOQL
Vector<Integer> keyset
Vector<Vector<Integer>> previousKeyset
Vector<String> keysetLabels
static Vector<Vector<Integer>> empty
Constructor Detail |
---|
public ComposedQuery(String[] sections, String queryLanguage)
sections
- usesHQL
- Method Detail |
---|
public DataDefinition getResultType()
public DataDefinition getLabelType(String s)
s
- the name of the label
public void init()
public String getFromSection()
public String getGroupBySection()
protected void initKeysets()
protected void addSubquery(ComposedSubquery q)
q
- the subqueryprotected void prependFromToKeyset()
public String getProjectionAt(int n)
n
- the index of the projection
Integer addProjection(String expr)
expr
- the expression to add
public Integer checkProjectionInteger(String expr)
expr
- the expression to add
String checkProjection(String expr)
expr
- the expression to add
public static String columnName(Integer n)
n
- the index of the column
String checkExpr(String str)
str
- an orderBy or groupBy expression
protected String computeQuery(String[] derivedSections, boolean typeAnalysisOnly)
derivedSections
- the sections of this querytypeAnalysisOnly
- indicates whether this is only a type analysis
public Grouper execute(QueryProvider qep, Map args, ComposedQuery.Evaluator v, int offset, int limit) throws LogicException
qep
- the database where the query should be ranargs
- the arguments we may need during the executionv
- the evaluator evaluating the expressionsoffset
- at which iteration this query should startlimit
- how many times should this query be ran
LogicException
public void analyze()
public void addProjectionDirectly(String s)
QueryTag.doAnalyzedStartTag(org.makumba.analyser.PageCache)
to compose a query with 'count(*)' as the
only projection.
public String toString()
toString
in class Object
public String getComputedQuery()
public String getTypeAnalyzerQuery()
public Vector<String> getProjections()
Vector
containing the projections of this ComposedQuerypublic DataDefinition getProjectionTypes()
public Map<String,DataDefinition> getFromLabelTypes()
public Object checkExprSetOrNullable(String expr)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |