com.healthmarketscience.jackcess.impl.query
Class QueryImpl

java.lang.Object
  extended by com.healthmarketscience.jackcess.impl.query.QueryImpl
All Implemented Interfaces:
Query
Direct Known Subclasses:
BaseSelectQueryImpl, DataDefinitionQueryImpl, PassthroughQueryImpl, UnionQueryImpl, UpdateQueryImpl

public abstract class QueryImpl
extends Object
implements Query

Base class for classes which encapsulate information about an Access query. The toSQLString() method can be used to convert this object into the actual SQL string which this query data represents.

Author:
James Ahlborn

Nested Class Summary
protected static class QueryImpl.AppendableList<E>
           
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
           
 
Nested classes/interfaces inherited from interface com.healthmarketscience.jackcess.query.Query
Query.Type
 
Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
protected QueryImpl(String name, List<QueryImpl.Row> rows, int objectId, int objectFlag, Query.Type type)
           
 
Method Summary
static QueryImpl create(int objectFlag, String name, List<QueryImpl.Row> rows, int objectId)
          Creates a concrete Query instance from the given query data.
protected static List<QueryImpl.Row> filterRowsByFlag(List<QueryImpl.Row> rows, short flag)
           
protected static List<QueryImpl.Row> filterRowsByNotFlag(List<QueryImpl.Row> rows, short flag)
           
protected  List<QueryImpl.Row> getColumnRows()
           
protected  QueryImpl.Row getFlagRow()
           
protected  String getFromRemoteDbPath()
           
protected  String getFromRemoteDbType()
           
protected  List<String> getFromTables()
           
protected  List<QueryImpl.Row> getGroupByRows()
           
protected  QueryImpl.Row getHavingRow()
           
protected static int getIntValue(Integer i, int def)
           
protected  List<QueryImpl.Row> getJoinRows()
           
 String getName()
          Returns the name of the query.
 int getObjectFlag()
           
 int getObjectId()
          Returns the unique object id of the query.
protected  List<QueryImpl.Row> getOrderByRows()
           
protected  List<String> getOrderings()
           
 String getOwnerAccessType()
           
protected  List<QueryImpl.Row> getParameterRows()
           
 List<String> getParameters()
          Returns the rows from the system query table from which the query information was derived.
protected  QueryImpl.Row getRemoteDatabaseRow()
           
protected  QueryImpl.Row getRowByAttribute(Byte attribute)
           
 List<QueryImpl.Row> getRows()
          Returns the rows from the system query table from which the query information was derived.
protected  List<QueryImpl.Row> getRowsByAttribute(Byte attribute)
           
protected static short getShortValue(Short s, int def)
           
protected  List<QueryImpl.Row> getTableRows()
           
 Query.Type getType()
          Returns the type of the query.
 QueryImpl.Row getTypeRow()
           
protected  QueryImpl.Row getUniqueRow(List<QueryImpl.Row> rows)
           
protected  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(String expr)
           
protected  boolean supportsStandardClauses()
           
protected static StringBuilder toAlias(StringBuilder builder, String alias)
           
protected static StringBuilder toOptionalQuotedExpr(StringBuilder builder, String fullExpr, boolean isIdentifier)
           
protected static StringBuilder toQuotedExpr(StringBuilder builder, String expr)
           
protected static StringBuilder toRemoteDb(StringBuilder builder, String remoteDbPath, String remoteDbType)
           
protected  void toSQLParameterString(StringBuilder builder)
           
 String toSQLString()
          Returns the actual SQL string which this query data represents.
protected abstract  void toSQLString(StringBuilder builder)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

QueryImpl

protected QueryImpl(String name,
                    List<QueryImpl.Row> rows,
                    int objectId,
                    int objectFlag,
                    Query.Type type)
Method Detail

getName

public String getName()
Returns the name of the query.

Specified by:
getName in interface Query

getType

public Query.Type getType()
Returns the type of the query.

Specified by:
getType in interface Query

isHidden

public boolean isHidden()
Description copied from interface: Query
Whether or not this query has been marked as hidden.

Specified by:
isHidden in interface Query

getObjectId

public int getObjectId()
Returns the unique object id of the query.

Specified by:
getObjectId in interface Query

getObjectFlag

public int getObjectFlag()
Specified by:
getObjectFlag in interface Query

getRows

public List<QueryImpl.Row> getRows()
Returns the rows from the system query table from which the query information was derived.


getRowsByAttribute

protected List<QueryImpl.Row> getRowsByAttribute(Byte attribute)

getRowByAttribute

protected QueryImpl.Row getRowByAttribute(Byte attribute)

getTypeRow

public QueryImpl.Row getTypeRow()

getParameterRows

protected List<QueryImpl.Row> getParameterRows()

getFlagRow

protected QueryImpl.Row getFlagRow()

getRemoteDatabaseRow

protected QueryImpl.Row getRemoteDatabaseRow()

getTableRows

protected List<QueryImpl.Row> getTableRows()

getColumnRows

protected List<QueryImpl.Row> getColumnRows()

getJoinRows

protected List<QueryImpl.Row> getJoinRows()

getWhereRow

protected QueryImpl.Row getWhereRow()

getGroupByRows

protected List<QueryImpl.Row> getGroupByRows()

getHavingRow

protected QueryImpl.Row getHavingRow()

getOrderByRows

protected List<QueryImpl.Row> getOrderByRows()

toSQLString

protected abstract void toSQLString(StringBuilder builder)

toSQLParameterString

protected void toSQLParameterString(StringBuilder builder)

getParameters

public List<String> getParameters()
Description copied from interface: Query
Returns the rows from the system query table from which the query information was derived.

Specified by:
getParameters in interface Query

getFromTables

protected List<String> getFromTables()

getFromRemoteDbPath

protected String getFromRemoteDbPath()

getFromRemoteDbType

protected String getFromRemoteDbType()

getWhereExpression

protected String getWhereExpression()

getOrderings

protected List<String> getOrderings()

getOwnerAccessType

public String getOwnerAccessType()
Specified by:
getOwnerAccessType in interface Query

hasFlag

protected boolean hasFlag(int flagMask)

supportsStandardClauses

protected boolean supportsStandardClauses()

toSQLString

public String toSQLString()
Returns the actual SQL string which this query data represents.

Specified by:
toSQLString in interface Query

toString

public String toString()
Overrides:
toString in class Object

create

public static QueryImpl create(int objectFlag,
                               String name,
                               List<QueryImpl.Row> rows,
                               int objectId)
Creates a concrete Query instance from the given query data.

Parameters:
objectFlag - the flag indicating the type of the query
name - the name of the query
rows - the rows from the system query table containing the data describing this query
objectId - the unique object id of this query
Returns:
a Query instance for the given query data

getUniqueRow

protected QueryImpl.Row getUniqueRow(List<QueryImpl.Row> rows)

filterRowsByFlag

protected static List<QueryImpl.Row> filterRowsByFlag(List<QueryImpl.Row> rows,
                                                      short flag)

filterRowsByNotFlag

protected static List<QueryImpl.Row> filterRowsByNotFlag(List<QueryImpl.Row> rows,
                                                         short flag)

hasFlag

protected static boolean hasFlag(QueryImpl.Row row,
                                 int flagMask)

getShortValue

protected static short getShortValue(Short s,
                                     int def)

getIntValue

protected static int getIntValue(Integer i,
                                 int def)

toOptionalQuotedExpr

protected static StringBuilder toOptionalQuotedExpr(StringBuilder builder,
                                                    String fullExpr,
                                                    boolean isIdentifier)

toQuotedExpr

protected static StringBuilder toQuotedExpr(StringBuilder builder,
                                            String expr)

isQuoted

protected static boolean isQuoted(String expr)

toRemoteDb

protected static StringBuilder toRemoteDb(StringBuilder builder,
                                          String remoteDbPath,
                                          String remoteDbType)

toAlias

protected static StringBuilder toAlias(StringBuilder builder,
                                       String alias)


Copyright © 2005-2017 Health Market Science. All Rights Reserved.