|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.ojb.broker.accesslayer.sql.SqlQueryStatement
Model a Statement based on Query.
| Nested Class Summary | |
(package private) static class |
SqlQueryStatement.AttributeInfo
This class is a helper to return TableAlias and PathInfo |
(package private) class |
SqlQueryStatement.Join
This class represents join between two TableAliases |
(package private) static class |
SqlQueryStatement.TableAlias
This class represents one table (possibly with alias) in the SQL query |
| Field Summary | |
(package private) Logger |
m_logger
the logger |
| Fields inherited from interface org.apache.ojb.broker.accesslayer.JoinSyntaxTypes |
ORACLE_JOIN_SYNTAX, SQL92_JOIN_SYNTAX, SQL92_NOPAREN_JOIN_SYNTAX, SYBASE_JOIN_SYNTAX |
| Constructor Summary | |
SqlQueryStatement(Platform pf,
ClassDescriptor cld,
Query query,
Logger logger)
Constructor for SqlCriteriaStatement. |
|
SqlQueryStatement(SqlQueryStatement parent,
Platform pf,
ClassDescriptor cld,
Query query,
Logger logger)
Constructor for SqlCriteriaStatement. |
|
| Method Summary | |
protected void |
appendClause(java.lang.StringBuffer clause,
Criteria crit,
java.lang.StringBuffer stmt)
appends a WHERE/HAVING-clause to the Statement |
protected boolean |
appendColName(SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo,
boolean translate,
java.lang.StringBuffer buf)
Add the Column to the StringBuffer |
protected boolean |
appendColName(java.lang.String attr,
boolean useOuterJoins,
java.lang.String aUserAlias,
java.lang.StringBuffer buf)
Append the appropriate ColumnName to the buffer if a FIELDDESCRIPTOR is found for the Criteria the colName is taken from there otherwise its taken from Criteria. |
protected boolean |
appendColName(java.lang.String attr,
java.lang.String attrAlias,
boolean useOuterJoins,
java.lang.String aUserAlias,
java.lang.StringBuffer buf)
Append the appropriate ColumnName to the buffer if a FIELDDESCRIPTOR is found for the Criteria the colName is taken from there otherwise its taken from Criteria. |
protected void |
appendCriteria(SqlQueryStatement.TableAlias alias,
SqlHelper.PathInfo pathInfo,
SelectionCriteria c,
java.lang.StringBuffer buf)
Answer the SQL-Clause for a SelectionCriteria |
protected void |
appendGroupByClause(java.util.List groupByFields,
java.lang.StringBuffer buf)
Appends to the statement the GROUP BY clause for the Query |
protected void |
appendHavingClause(java.lang.StringBuffer having,
Criteria crit,
java.lang.StringBuffer stmt)
appends a HAVING-clause to the Statement |
protected void |
appendOrderByClause(java.util.List orderByFields,
int[] orderByColumnNumbers,
java.lang.StringBuffer buf)
Appends to the statement the ORDER BY clause for the Query |
protected void |
appendSQLClause(SelectionCriteria c,
java.lang.StringBuffer buf)
Answer the SQL-Clause for a SelectionCriteria If the Criteria references a class with extents an OR-Clause is added for each extent |
protected void |
appendTableWithJoins(SqlQueryStatement.TableAlias alias,
java.lang.StringBuffer where,
java.lang.StringBuffer buf)
Appends to the statement table and all tables joined to it. |
protected void |
appendWhereClause(java.lang.StringBuffer where,
Criteria crit,
java.lang.StringBuffer stmt)
appends a WHERE-clause to the Statement |
protected void |
buildSuperJoinTree(SqlQueryStatement.TableAlias left,
ClassDescriptor cld,
java.lang.String name)
build the Join-Information if a super reference exists |
protected int[] |
ensureColumns(java.util.List columns,
java.util.List existingColumns,
java.lang.StringBuffer buf)
Appends to the statement columns if they are not found among the existingColumns. |
protected SqlQueryStatement.AttributeInfo |
getAttributeInfo(java.lang.String attr,
boolean useOuterJoins,
java.lang.String aUserAlias)
Return the TableAlias and the PathInfo for an Attribute name field names in functions (ie: sum(name) ) are tried to resolve ie: name from FIELDDESCRIPTOR , UPPER(name_test) from Criteria also resolve pathExpression adress.city or owner.konti.saldo |
protected ClassDescriptor |
getBaseClassDescriptor()
|
protected java.lang.String |
getColName(SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo,
boolean translate)
Answer the column name for alias and path info if translate try to convert attribute name into column name otherwise use attribute name if a FieldDescriptor is found for the attribute name the column name is taken from there prefixed with the alias (firstname -> A0.F_NAME). |
protected FieldDescriptor |
getFieldDescriptor(SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo)
Get the FieldDescriptor for the PathInfo |
protected byte |
getJoinSyntaxType()
Returns the joinSyntaxType. |
protected java.util.HashMap |
getJoinTreeToCriteria()
Gets the joinTreeToCriteria. |
protected Logger |
getLogger()
Returns the logger. |
protected QueryByCriteria |
getQuery()
Gets the query. |
protected SqlQueryStatement.TableAlias |
getRoot()
Gets the root. |
protected ClassDescriptor |
getSearchClassDescriptor()
|
protected SqlQueryStatement.TableAlias |
getSearchTable()
Gets the search table of this query. |
protected void |
setRoot(SqlQueryStatement.TableAlias root)
Sets the root. |
protected void |
splitCriteria()
First reduce the Criteria to the normal disjunctive form, then calculate the necessary tree of joined tables for each item, then group items with the same tree of joined tables. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.ojb.broker.accesslayer.sql.SqlStatement |
getStatement |
| Field Detail |
Logger m_logger
| Constructor Detail |
public SqlQueryStatement(Platform pf,
ClassDescriptor cld,
Query query,
Logger logger)
public SqlQueryStatement(SqlQueryStatement parent,
Platform pf,
ClassDescriptor cld,
Query query,
Logger logger)
| Method Detail |
protected ClassDescriptor getBaseClassDescriptor()
protected ClassDescriptor getSearchClassDescriptor()
protected SqlQueryStatement.AttributeInfo getAttributeInfo(java.lang.String attr,
boolean useOuterJoins,
java.lang.String aUserAlias)
attr - useOuterJoins - aUserAlias -
protected java.lang.String getColName(SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo,
boolean translate)
aTableAlias - aPathInfo - translate -
protected boolean appendColName(SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo,
boolean translate,
java.lang.StringBuffer buf)
aTableAlias - aPathInfo - buf -
protected FieldDescriptor getFieldDescriptor(SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo)
aTableAlias - aPathInfo -
protected boolean appendColName(java.lang.String attr,
boolean useOuterJoins,
java.lang.String aUserAlias,
java.lang.StringBuffer buf)
attr - useOuterJoins - aUserAlias - buf -
protected boolean appendColName(java.lang.String attr,
java.lang.String attrAlias,
boolean useOuterJoins,
java.lang.String aUserAlias,
java.lang.StringBuffer buf)
attr - useOuterJoins - aUserAlias - buf -
protected void appendWhereClause(java.lang.StringBuffer where,
Criteria crit,
java.lang.StringBuffer stmt)
where - crit - stmt -
protected void appendHavingClause(java.lang.StringBuffer having,
Criteria crit,
java.lang.StringBuffer stmt)
having - crit - stmt -
protected void appendClause(java.lang.StringBuffer clause,
Criteria crit,
java.lang.StringBuffer stmt)
clause - crit - stmt -
protected void appendCriteria(SqlQueryStatement.TableAlias alias,
SqlHelper.PathInfo pathInfo,
SelectionCriteria c,
java.lang.StringBuffer buf)
alias - pathInfo - c - SelectionCriteriabuf -
protected void appendSQLClause(SelectionCriteria c,
java.lang.StringBuffer buf)
c - SelectionCriteria
protected void appendOrderByClause(java.util.List orderByFields,
int[] orderByColumnNumbers,
java.lang.StringBuffer buf)
protected void appendGroupByClause(java.util.List groupByFields,
java.lang.StringBuffer buf)
protected void appendTableWithJoins(SqlQueryStatement.TableAlias alias,
java.lang.StringBuffer where,
java.lang.StringBuffer buf)
alias - the table aliaswhere - append conditions for WHERE clause here
protected int[] ensureColumns(java.util.List columns,
java.util.List existingColumns,
java.lang.StringBuffer buf)
columns - the list of columns represented by Criteria.Field to ensureexistingColumns - the list of column names (String) that are already appended
protected void buildSuperJoinTree(SqlQueryStatement.TableAlias left,
ClassDescriptor cld,
java.lang.String name)
left - cld - name - protected void splitCriteria()
protected QueryByCriteria getQuery()
protected SqlQueryStatement.TableAlias getRoot()
protected void setRoot(SqlQueryStatement.TableAlias root)
root - The root to setprotected SqlQueryStatement.TableAlias getSearchTable()
protected java.util.HashMap getJoinTreeToCriteria()
protected byte getJoinSyntaxType()
protected Logger getLogger()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||