public abstract class QueryImpl extends java.lang.Object implements Query
toSQLString() method can be used to convert this object into
the actual SQL string which this query data represents.| Modifier and Type | Class and Description |
|---|---|
protected static class |
QueryImpl.AppendableList<E> |
private static class |
QueryImpl.Join |
static class |
QueryImpl.Row
Struct containing the information from a single row of the system query
table.
|
protected static class |
QueryImpl.RowFilter |
protected static class |
QueryImpl.RowFormatter |
private static class |
QueryImpl.UnknownQueryImpl |
Query.Type| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
_name |
private int |
_objectFlag |
private int |
_objectId |
private java.util.List<QueryImpl.Row> |
_rows |
private Query.Type |
_type |
private static QueryImpl.Row |
EMPTY_ROW |
protected static org.apache.commons.logging.Log |
LOG |
| Modifier | Constructor and Description |
|---|---|
protected |
QueryImpl(java.lang.String name,
java.util.List<QueryImpl.Row> rows,
int objectId,
int objectFlag,
Query.Type type) |
| Modifier and Type | Method and Description |
|---|---|
private java.util.Collection<java.util.List<QueryImpl.Row>> |
combineJoins(java.util.List<QueryImpl.Row> joins) |
static QueryImpl |
create(int objectFlag,
java.lang.String name,
java.util.List<QueryImpl.Row> rows,
int objectId)
Creates a concrete Query instance from the given query data.
|
protected static java.util.List<QueryImpl.Row> |
filterRowsByFlag(java.util.List<QueryImpl.Row> rows,
short flag) |
protected static java.util.List<QueryImpl.Row> |
filterRowsByNotFlag(java.util.List<QueryImpl.Row> rows,
short flag) |
protected java.util.List<QueryImpl.Row> |
getColumnRows() |
protected QueryImpl.Row |
getFlagRow() |
protected java.lang.String |
getFromRemoteDbPath() |
protected java.lang.String |
getFromRemoteDbType() |
protected java.util.List<java.lang.String> |
getFromTables() |
protected java.util.List<QueryImpl.Row> |
getGroupByRows() |
protected QueryImpl.Row |
getHavingRow() |
protected static int |
getIntValue(java.lang.Integer i,
int def) |
private QueryImpl.Join |
getJoinExpr(java.lang.String table,
java.util.List<QueryImpl.Join> joinExprs) |
protected java.util.List<QueryImpl.Row> |
getJoinRows() |
java.lang.String |
getName()
Returns the name of the query.
|
int |
getObjectFlag() |
int |
getObjectId()
Returns the unique object id of the query.
|
protected java.util.List<QueryImpl.Row> |
getOrderByRows() |
protected java.util.List<java.lang.String> |
getOrderings() |
java.lang.String |
getOwnerAccessType() |
protected java.util.List<QueryImpl.Row> |
getParameterRows() |
java.util.List<java.lang.String> |
getParameters()
Returns the rows from the system query table from which the query
information was derived.
|
private java.lang.Short |
getQueryType(java.util.List<QueryImpl.Row> rows) |
protected QueryImpl.Row |
getRemoteDatabaseRow() |
protected QueryImpl.Row |
getRowByAttribute(java.lang.Byte attribute) |
java.util.List<QueryImpl.Row> |
getRows()
Returns the rows from the system query table from which the query
information was derived.
|
protected java.util.List<QueryImpl.Row> |
getRowsByAttribute(java.lang.Byte attribute) |
private static java.util.List<QueryImpl.Row> |
getRowsByAttribute(java.util.List<QueryImpl.Row> rows,
java.lang.Byte attribute) |
protected static short |
getShortValue(java.lang.Short s,
int def) |
protected java.util.List<QueryImpl.Row> |
getTableRows() |
Query.Type |
getType()
Returns the type of the query.
|
QueryImpl.Row |
getTypeRow() |
protected QueryImpl.Row |
getUniqueRow(java.util.List<QueryImpl.Row> rows) |
protected java.lang.String |
getWhereExpression() |
protected QueryImpl.Row |
getWhereRow() |
protected boolean |
hasFlag(int flagMask) |
protected static boolean |
hasFlag(QueryImpl.Row row,
int flagMask) |
boolean |
isHidden()
Whether or not this query has been marked as hidden.
|
protected static boolean |
isQuoted(java.lang.String expr) |
protected boolean |
supportsStandardClauses() |
protected static java.lang.StringBuilder |
toAlias(java.lang.StringBuilder builder,
java.lang.String alias) |
protected static java.lang.StringBuilder |
toOptionalQuotedExpr(java.lang.StringBuilder builder,
java.lang.String fullExpr,
boolean isIdentifier) |
protected static java.lang.StringBuilder |
toQuotedExpr(java.lang.StringBuilder builder,
java.lang.String expr) |
protected static java.lang.StringBuilder |
toRemoteDb(java.lang.StringBuilder builder,
java.lang.String remoteDbPath,
java.lang.String remoteDbType) |
protected void |
toSQLParameterString(java.lang.StringBuilder builder) |
java.lang.String |
toSQLString()
Returns the actual SQL string which this query data represents.
|
protected abstract void |
toSQLString(java.lang.StringBuilder builder) |
java.lang.String |
toString() |
private java.lang.String |
withErrorContext(java.lang.String msg) |
private static java.lang.String |
withErrorContext(java.lang.String msg,
java.lang.String queryName) |
protected static final org.apache.commons.logging.Log LOG
private static final QueryImpl.Row EMPTY_ROW
private final java.lang.String _name
private final java.util.List<QueryImpl.Row> _rows
private final int _objectId
private final Query.Type _type
private final int _objectFlag
protected QueryImpl(java.lang.String name,
java.util.List<QueryImpl.Row> rows,
int objectId,
int objectFlag,
Query.Type type)
public java.lang.String getName()
public Query.Type getType()
public boolean isHidden()
Querypublic int getObjectId()
getObjectId in interface Querypublic int getObjectFlag()
getObjectFlag in interface Querypublic java.util.List<QueryImpl.Row> getRows()
protected java.util.List<QueryImpl.Row> getRowsByAttribute(java.lang.Byte attribute)
protected QueryImpl.Row getRowByAttribute(java.lang.Byte attribute)
public QueryImpl.Row getTypeRow()
protected java.util.List<QueryImpl.Row> getParameterRows()
protected QueryImpl.Row getFlagRow()
protected QueryImpl.Row getRemoteDatabaseRow()
protected java.util.List<QueryImpl.Row> getTableRows()
protected java.util.List<QueryImpl.Row> getColumnRows()
protected java.util.List<QueryImpl.Row> getJoinRows()
protected QueryImpl.Row getWhereRow()
protected java.util.List<QueryImpl.Row> getGroupByRows()
protected QueryImpl.Row getHavingRow()
protected java.util.List<QueryImpl.Row> getOrderByRows()
protected abstract void toSQLString(java.lang.StringBuilder builder)
protected void toSQLParameterString(java.lang.StringBuilder builder)
public java.util.List<java.lang.String> getParameters()
QuerygetParameters in interface Queryprotected java.util.List<java.lang.String> getFromTables()
private QueryImpl.Join getJoinExpr(java.lang.String table, java.util.List<QueryImpl.Join> joinExprs)
private java.util.Collection<java.util.List<QueryImpl.Row>> combineJoins(java.util.List<QueryImpl.Row> joins)
protected java.lang.String getFromRemoteDbPath()
protected java.lang.String getFromRemoteDbType()
protected java.lang.String getWhereExpression()
protected java.util.List<java.lang.String> getOrderings()
public java.lang.String getOwnerAccessType()
getOwnerAccessType in interface Queryprotected boolean hasFlag(int flagMask)
protected boolean supportsStandardClauses()
public java.lang.String toSQLString()
toSQLString in interface Querypublic java.lang.String toString()
toString in class java.lang.Objectpublic static QueryImpl create(int objectFlag, java.lang.String name, java.util.List<QueryImpl.Row> rows, int objectId)
objectFlag - the flag indicating the type of the queryname - the name of the queryrows - the rows from the system query table containing the data
describing this queryobjectId - the unique object id of this queryprivate java.lang.Short getQueryType(java.util.List<QueryImpl.Row> rows)
private static java.util.List<QueryImpl.Row> getRowsByAttribute(java.util.List<QueryImpl.Row> rows, java.lang.Byte attribute)
protected QueryImpl.Row getUniqueRow(java.util.List<QueryImpl.Row> rows)
protected static java.util.List<QueryImpl.Row> filterRowsByFlag(java.util.List<QueryImpl.Row> rows, short flag)
protected static java.util.List<QueryImpl.Row> filterRowsByNotFlag(java.util.List<QueryImpl.Row> rows, short flag)
protected static boolean hasFlag(QueryImpl.Row row, int flagMask)
protected static short getShortValue(java.lang.Short s,
int def)
protected static int getIntValue(java.lang.Integer i,
int def)
protected static java.lang.StringBuilder toOptionalQuotedExpr(java.lang.StringBuilder builder,
java.lang.String fullExpr,
boolean isIdentifier)
protected static java.lang.StringBuilder toQuotedExpr(java.lang.StringBuilder builder,
java.lang.String expr)
protected static boolean isQuoted(java.lang.String expr)
protected static java.lang.StringBuilder toRemoteDb(java.lang.StringBuilder builder,
java.lang.String remoteDbPath,
java.lang.String remoteDbType)
protected static java.lang.StringBuilder toAlias(java.lang.StringBuilder builder,
java.lang.String alias)
private java.lang.String withErrorContext(java.lang.String msg)
private static java.lang.String withErrorContext(java.lang.String msg,
java.lang.String queryName)