|
||||||||||
| 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
public abstract class SqlQueryStatement
Model a Statement based on Query.
| Field Summary | |
|---|---|
protected HashMap |
m_attrToFld
|
| 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(StringBuffer clause,
Criteria crit,
StringBuffer stmt)
appends a WHERE/HAVING-clause to the Statement |
protected boolean |
appendColName(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo,
boolean translate,
StringBuffer buf)
Add the Column to the StringBuffer |
protected boolean |
appendColName(String attr,
boolean useOuterJoins,
UserAlias aUserAlias,
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(String attr,
String attrAlias,
boolean useOuterJoins,
UserAlias aUserAlias,
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(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias alias,
SqlHelper.PathInfo pathInfo,
SelectionCriteria c,
StringBuffer buf)
Answer the SQL-Clause for a SelectionCriteria |
protected void |
appendGroupByClause(List groupByFields,
StringBuffer buf)
Appends the GROUP BY clause for the Query |
protected void |
appendHavingClause(StringBuffer having,
Criteria crit,
StringBuffer stmt)
appends a HAVING-clause to the Statement |
protected void |
appendOrderByClause(List orderByFields,
List selectedFields,
StringBuffer buf)
Appends the ORDER BY clause for the Query. |
protected void |
appendSQLClause(SelectionCriteria c,
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(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias alias,
StringBuffer where,
StringBuffer buf)
Appends to the statement table and all tables joined to it. |
protected void |
appendWhereClause(StringBuffer where,
Criteria crit,
StringBuffer stmt)
appends a WHERE-clause to the Statement |
protected abstract String |
buildStatement()
Build the SQL String. |
protected void |
buildSuperJoinTree(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias left,
ClassDescriptor cld,
String name,
boolean useOuterJoin)
build the Join-Information if a super reference exists |
protected void |
ensureColumns(List columns,
List existingColumns)
Builds the Join for columns if they are not found among the existingColumns. |
protected List |
ensureColumns(List columns,
List existingColumns,
StringBuffer buf)
Builds the Join for columns if they are not found among the existingColumns. |
protected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.AttributeInfo |
getAttributeInfo(String attr,
boolean useOuterJoins,
UserAlias aUserAlias,
Map pathClasses)
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 String |
getColName(org.apache.ojb.broker.accesslayer.sql.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(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo)
Get the FieldDescriptor for the PathInfo |
protected byte |
getJoinSyntaxType()
Returns the joinSyntaxType. |
protected HashMap |
getJoinTreeToCriteria()
Gets the joinTreeToCriteria. |
protected Logger |
getLogger()
Returns the logger. |
protected QueryByCriteria |
getQuery()
Gets the query. |
protected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias |
getRoot()
Gets the root. |
protected ClassDescriptor |
getSearchClassDescriptor()
|
protected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias |
getSearchTable()
Gets the search table of this query. |
String |
getStatement()
Answer the SELECT by primary key Sql for the Statement |
protected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias |
getTableAliasForClassDescriptor(ClassDescriptor aCld)
Answer the TableAlias for ClassDescriptor. |
protected void |
setRoot(org.apache.ojb.broker.accesslayer.sql.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 |
| Field Detail |
|---|
protected HashMap m_attrToFld
| Constructor Detail |
|---|
public SqlQueryStatement(Platform pf,
ClassDescriptor cld,
Query query,
Logger logger)
pf - the Platformcld - the ClassDescriptorquery - the Querylogger - the Logger
public SqlQueryStatement(SqlQueryStatement parent,
Platform pf,
ClassDescriptor cld,
Query query,
Logger logger)
parent - the Parent Querypf - the Platformcld - the ClassDescriptorquery - the Querylogger - the Logger| Method Detail |
|---|
protected ClassDescriptor getBaseClassDescriptor()
protected ClassDescriptor getSearchClassDescriptor()
protected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.AttributeInfo getAttributeInfo(String attr,
boolean useOuterJoins,
UserAlias aUserAlias,
Map pathClasses)
attr - useOuterJoins - aUserAlias - pathClasses -
protected String getColName(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo,
boolean translate)
protected boolean appendColName(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo,
boolean translate,
StringBuffer buf)
aTableAlias - aPathInfo - translate - flag to indicate translation of pathInfobuf -
protected FieldDescriptor getFieldDescriptor(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias aTableAlias,
SqlHelper.PathInfo aPathInfo)
aTableAlias - aPathInfo -
protected boolean appendColName(String attr,
boolean useOuterJoins,
UserAlias aUserAlias,
StringBuffer buf)
protected boolean appendColName(String attr,
String attrAlias,
boolean useOuterJoins,
UserAlias aUserAlias,
StringBuffer buf)
protected void ensureColumns(List columns,
List existingColumns)
columns - the list of columns represented by Criteria.Field to ensureexistingColumns - the list of column names (String) that are already appended
protected List ensureColumns(List columns,
List existingColumns,
StringBuffer buf)
columns - the list of columns represented by Criteria.Field to ensureexistingColumns - the list of column names (String) that are already appendedbuf - the statement
protected void appendWhereClause(StringBuffer where,
Criteria crit,
StringBuffer stmt)
where - crit - stmt -
protected void appendHavingClause(StringBuffer having,
Criteria crit,
StringBuffer stmt)
having - crit - stmt -
protected void appendClause(StringBuffer clause,
Criteria crit,
StringBuffer stmt)
clause - crit - stmt -
protected void appendCriteria(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias alias,
SqlHelper.PathInfo pathInfo,
SelectionCriteria c,
StringBuffer buf)
alias - pathInfo - c - SelectionCriteriabuf -
protected void appendSQLClause(SelectionCriteria c,
StringBuffer buf)
c - SelectionCriteriaprotected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias getTableAliasForClassDescriptor(ClassDescriptor aCld)
protected void appendOrderByClause(List orderByFields,
List selectedFields,
StringBuffer buf)
orderByFields - selectedFields - the names of the fields in the SELECT clausebuf -
protected void appendGroupByClause(List groupByFields,
StringBuffer buf)
groupByFields - buf -
protected void appendTableWithJoins(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias alias,
StringBuffer where,
StringBuffer buf)
alias - the table aliaswhere - append conditions for WHERE clause here
protected void buildSuperJoinTree(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias left,
ClassDescriptor cld,
String name,
boolean useOuterJoin)
left - cld - name - protected void splitCriteria()
protected QueryByCriteria getQuery()
protected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias getRoot()
protected void setRoot(org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias root)
root - The root to setprotected org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.TableAlias getSearchTable()
protected HashMap getJoinTreeToCriteria()
protected byte getJoinSyntaxType()
protected Logger getLogger()
public String getStatement()
SqlStatement
getStatement in interface SqlStatementprotected abstract String buildStatement()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||