|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.makumba.providers.query.QuerySectionProcessor
public class QuerySectionProcessor
Given a query and a starting point, this class identifies the subquery where the starting point is, its parent query, its grandparent query ... ending with the outer query. After this analysis, it can insert text in the query and expand the FROM and WHERE sections. For all queries and subqueries the class separates the projection, FROM and WHERE sections. To analyze/process just the outer query, use 0 as a starting point.
Nested Class Summary | |
---|---|
(package private) static class |
QuerySectionProcessor.Insertion
|
(package private) class |
QuerySectionProcessor.SubqueryData
|
Field Summary | |
---|---|
static Pattern |
allFunctionBegin
|
(package private) boolean |
closed
|
static Pattern |
ident
|
static String |
PATTERN_ALL_FUNCTION_CALL_BEGIN
|
(package private) StringBuffer |
query
|
(package private) ArrayList<QuerySectionProcessor.SubqueryData> |
subqueries
|
Constructor Summary | |
---|---|
QuerySectionProcessor(String query,
int startPoint)
|
Method Summary | |
---|---|
void |
addFromWhere(QuerySectionProcessor func,
String thisExpr)
Given a query, add from it to the FROM section and to the WHERE condition of the outermost possible suquery. |
void |
addFromWhere(String from,
String where)
Add to the FROM section and to the WHERE condition of the outermost suquery. |
String |
getFrom()
Return the FROM section of the outer query, without the word FROM |
String |
getInitialFrom()
Return the initial FROM section of all subqueries up to the starting point. |
String |
getProjectionText()
Return the projection section of the outer query, without the word SELECT |
String |
getText()
Return the query text |
String |
getWhere()
Return the WHERE section of the outer query, without the word WHERE. |
static void |
main(String[] argv)
|
(package private) static String |
paranthesize(String before,
String after,
String expr)
|
void |
replaceExpr(int regionStart,
int regionLength,
String text)
Replace the expression begining at regionStart, of length regionLength with the given text. |
void |
replaceParameter(String name,
String parameterInline)
Inline a parameter. |
(package private) void |
replaceThis(String thisExpr)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
StringBuffer query
ArrayList<QuerySectionProcessor.SubqueryData> subqueries
boolean closed
public static final String PATTERN_ALL_FUNCTION_CALL_BEGIN
public static final Pattern allFunctionBegin
public static final Pattern ident
Constructor Detail |
---|
public QuerySectionProcessor(String query, int startPoint)
Method Detail |
---|
public String getInitialFrom()
public String getProjectionText()
public void replaceParameter(String name, String parameterInline)
void replaceThis(String thisExpr)
public void replaceExpr(int regionStart, int regionLength, String text)
public void addFromWhere(QuerySectionProcessor func, String thisExpr)
func
- the section processor of the function expression that might contain a from or a wherethisExpr
- the object that will substitute "this" in the expressionpublic void addFromWhere(String from, String where)
from
- the from sectionwhere
- the where section for joining itpublic String getText()
public String getWhere()
public String getFrom()
static String paranthesize(String before, String after, String expr)
public static void main(String[] argv)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |