Novell exteNd
Director 5.0 API

com.sssw.fw.persist.jdbc.api
Interface EbiJdbcQuery

All Superinterfaces:
EbiQuery, EbiQueryBase, Serializable
All Known Subinterfaces:
EbiAclQuery, EbiJdbcMetaDataQuery

public interface EbiJdbcQuery
extends EbiQuery

This interface defines a generic SQL query. It's used to construct queries that return result sets.


Method Summary
 void addJoin(int joinType, String joinTable, String[] fromColumns, String[] toColumns)
          Specify a JOIN clause for a query
 void addJoin(int joinType, String joinTable, String joinAlias, String[] fromColumns, String[] toColumns, EbiQueryExpression exp)
          Specify a JOIN clause for a query using an alias.
 void addOrderBy(String columnName, boolean asc)
          Designate a column for ordering in a JDBC query.
 void addSelect(String columnName)
          Designate a column for selection in a JDBC query.
 void clear()
          Clear all selections related to this query except for PrimaryTable and PrimaryAlias; these remain the same.
 void clear(String tableName, String tableAlias)
          Clear all selections related to this query.
 boolean getDistinct()
          Get the Distinct attribute for the query.
 Boolean getEscapeProcessing()
          Get the EscapeProcessing attribute for the query.
 Integer getFetchDirection()
          Get the FetchDirection attribute for the query.
 Integer getFetchSize()
          Get the FetchSize attribute for the query.
 Object[] getInParameters()
          Get the In Parameters, if there is any.
 Integer getMaxFieldSize()
          Get the MaxFieldSize attribute for the query.
 Integer getMaxRows()
          Get the MaxRows attribute for the query.
 String getPrimaryAlias()
          Get the primary table's alias for the query.
 String getPrimaryTable()
          Get the primary table name for the query.
 Integer getQueryTimeout()
          Get the QueryTimeout attribute for the query.
 Collection getTables()
          Get a collection of table names (or their aliases) used in the query.
 EbiQueryExpression getWhere()
          Get a query's WHERE clause.
 void selectTableAll(String tableName)
          Select all columns for a table (i.e., SELECT tableName.*)
 void setDistinct(boolean distinct)
          Specify whether the SQL query should use the DISTINCT keyword.
 void setEscapeProcessing(Boolean escapeProcessing)
          Specify whether the query should use escape processing.
 void setFetchDirection(Integer fetchDirection)
          Specify a desired fetch direction to be used with the query.
 void setFetchSize(Integer fetchSize)
          Specify a desired fetch size to be used with the query.
 void setMaxFieldSize(Integer maxFieldSize)
          Specify a maximum column width to be returned by the query.
 void setMaxRows(Integer maxRows)
          Specify a maximum number of rows to be returned by the query.
 void setPrimaryTable(String tableName)
          Designate a primary table for the query
 void setPrimaryTable(String tableName, String tableAlias)
          Designate a primary table for the query
 void setQueryTimeout(Integer timeoutSeconds)
          Specify a timeout interval to be used with the query.
 void setWhere(EbiQueryExpression expr)
          Designate a WHERE clause for a JDBC query.
 EbiQueryExpression whereColumnBetween(String columnName, byte first, byte last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnBetween(String columnName, char first, char last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnBetween(String columnName, double first, double last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnBetween(String columnName, float first, float last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnBetween(String columnName, int first, int last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnBetween(String columnName, long first, long last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnBetween(String columnName, Object first, Object last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnBetween(String columnName, short first, short last, boolean not)
          Specify the search condition of "WHERE colummnName between .."
 EbiQueryExpression whereColumnIn(String columnName, byte[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, char[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, double[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, EbiQuery subQuery, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, float[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, int[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, long[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, Object[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnIn(String columnName, short[] values, boolean not)
          Specify the search condition of "WHERE columnName IN .."
 EbiQueryExpression whereColumnNull(String columnName, boolean not)
          Specify a null value condition of "WHERE columnName IS NULL"
 EbiQueryExpression whereColumnOp(String columnName, boolean value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, byte value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, char value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, double value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, float value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, int value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, long value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, Object value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereColumnOp(String columnName, short value, int op, boolean not)
          Specify the search condition of "WHERE columnName .."
 EbiQueryExpression whereExists(EbiQuery subQuery, boolean not)
          Specify the search condition of "WHERE EXISTS .."
 
Methods implemented from interface com.sssw.fw.api.EbiQuery
allSelected, deselectAll, getOrderBys, getQueryString, getSelects, removeOrderBys, selectAll
 

Method Detail

selectTableAll

public void selectTableAll(String tableName)
Select all columns for a table (i.e., SELECT tableName.*)
Parameters:
tableName - the name of the table for which all columns are selected.

getTables

public Collection getTables()
Get a collection of table names (or their aliases) used in the query.
Returns:
a collection of table name strings.

addSelect

public void addSelect(String columnName)
Designate a column for selection in a JDBC query.
Parameters:
columnName - a column name to be selected in the query.

addOrderBy

public void addOrderBy(String columnName,
                       boolean asc)
Designate a column for ordering in a JDBC query.
Parameters:
columnName - a column name to be used for ordering in a query.
asc - a boolean value indicating whether to use ascending order.

setWhere

public void setWhere(EbiQueryExpression expr)
Designate a WHERE clause for a JDBC query.
Parameters:
expr - an EbiQueryExpression containing the WHERE clause.

whereColumnNull

public EbiQueryExpression whereColumnNull(String columnName,
                                          boolean not)
Specify a null value condition of "WHERE columnName IS NULL"
Parameters:
columnName - the name of the column being evaluated
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        Object value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - an Object value for the condition, valid objects are defined in EboSqlHelper
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        boolean value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - a boolean value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        char value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - a char value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        byte value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - a byte value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        short value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - a short value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        int value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - an int value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        long value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - a long value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        float value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - a float value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnOp

public EbiQueryExpression whereColumnOp(String columnName,
                                        double value,
                                        int op,
                                        boolean not)
Specify the search condition of "WHERE columnName .."
Parameters:
columnName - the name of the column being evaluated
value - a double value for the condition
op - an operator, valid operators are defined in EboSqlHelper
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        Object[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - Object values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        char[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - char values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        byte[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - byte values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        short[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - short values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        int[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - int values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        long[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - long values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        float[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - float values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        double[] values,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
values - double values for the IN condition
not - whether to negate the condition
Returns:
the query expression

whereColumnIn

public EbiQueryExpression whereColumnIn(String columnName,
                                        EbiQuery subQuery,
                                        boolean not)
Specify the search condition of "WHERE columnName IN .."
Parameters:
columnName - the name of the column being evaluated
subQuery - an EbiQuery for the IN condition (i.e., a subquery)
not - whether to negate the condition
Returns:
the query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             Object first,
                                             Object last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start Object value for the range
last - the end Object value for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             char first,
                                             char last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start char for the range
last - the end char for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             byte first,
                                             byte last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start byte for the range
last - the end byte for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             short first,
                                             short last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start short for the range
last - the end short for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             int first,
                                             int last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start int for the range
last - the end int for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             long first,
                                             long last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start long for the range
last - the end long for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             float first,
                                             float last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start float for the range
last - the end float for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereColumnBetween

public EbiQueryExpression whereColumnBetween(String columnName,
                                             double first,
                                             double last,
                                             boolean not)
Specify the search condition of "WHERE colummnName between .."
Parameters:
columnName - the name of the column being evaluated
first - the start double for the range
last - the end double for the range
not - whether to negate the condition
Returns:
the constructed query expression

whereExists

public EbiQueryExpression whereExists(EbiQuery subQuery,
                                      boolean not)
Specify the search condition of "WHERE EXISTS .."
Parameters:
subQuery - an EbiQuery for the EXISTS condition (i.e., a subquery)
not - whether to negate the condition
Returns:
the query expression

getWhere

public EbiQueryExpression getWhere()
Get a query's WHERE clause.
Returns:
an EbiQueryExpression containing the WHERE clause.

addJoin

public void addJoin(int joinType,
                    String joinTable,
                    String[] fromColumns,
                    String[] toColumns)
Specify a JOIN clause for a query
Parameters:
joinType - an int identifying the type of join (e.g., INNER, LEFT OUTER), valid join types are defined in EboSqlHelper
joinTable - name of table to be joined to. Joins are always from the previous table specified to the table defined in the addJoin method. The first join in a query is always from the query's primary table.
fromColumns - an array identifying the column(s) to be joined on from the first table in a join.
toColumns - an array identifying the column(s) to be joined on from the second table in a join (i.e., the table specified in joinTable)

addJoin

public void addJoin(int joinType,
                    String joinTable,
                    String joinAlias,
                    String[] fromColumns,
                    String[] toColumns,
                    EbiQueryExpression exp)
Specify a JOIN clause for a query using an alias. This is necessary if a table is being joined onto itself.
Parameters:
joinType - an int identifying the type of join (e.g., INNER, LEFT OUTER), valid join types are defined on EboSqlHelper
joinTable - name of table to be joined to. Joins are always from the previous table specified to the table defined in the addJoin method. The first join in a query is always from the query's primary table.
joinAlias - an alias for the joinTable; can be null if a table is not being joined onto itself.
fromColumns - an array identifying the column(s) to be joined on from the first table in a join.
toColumns - an array identifying the column(s) to be joined on from the second table in a join (i.e., the table specified in joinTable)
exp - an expression to be appended to the join. Can be null. This differs from the query expression contained in the WHERE clause because the join will fail if this expression isn't satisfied.

clear

public void clear()
Clear all selections related to this query except for PrimaryTable and PrimaryAlias; these remain the same.

clear

public void clear(String tableName,
                  String tableAlias)
Clear all selections related to this query.
Parameters:
tableName - is the primary table for the new query
tableAlias - is the primary table's alias for the new query, may be null

setPrimaryTable

public void setPrimaryTable(String tableName)
Designate a primary table for the query
Parameters:
tableName - is the primary table for the new query

setPrimaryTable

public void setPrimaryTable(String tableName,
                            String tableAlias)
Designate a primary table for the query
Parameters:
tableName - is the primary table for the new query
tableAlias - is the primary table's alias for the new query, may be null

getPrimaryTable

public String getPrimaryTable()
Get the primary table name for the query.
Returns:
a table name.

getPrimaryAlias

public String getPrimaryAlias()
Get the primary table's alias for the query.
Returns:
a table alias, may be null.

setMaxRows

public void setMaxRows(Integer maxRows)
Specify a maximum number of rows to be returned by the query. This attribute is applied to the JDBC Statement used to execute the query. Note that some JDBC drivers may not support this attribute.
Parameters:
maxRows - is an Integer containing the maximum rows to be returned.

getMaxRows

public Integer getMaxRows()
Get the MaxRows attribute for the query. This method will return null if the attribute hasn't been set. If the attribute is not set, the JDBC statement will use a default value.
Returns:
an Integer value, may be null.

setMaxFieldSize

public void setMaxFieldSize(Integer maxFieldSize)
Specify a maximum column width to be returned by the query. This attribute is applied to the JDBC Statement used to execute the query. Note that some JDBC drivers may not support this attribute.
Parameters:
maxFieldSize - is an Integer containing the maximum column width to be returned.

getMaxFieldSize

public Integer getMaxFieldSize()
Get the MaxFieldSize attribute for the query. This method will return null if the attribute hasn't been set. If the attribute is not set, the JDBC statement will use a default value.
Returns:
an Integer value, may be null.

setFetchSize

public void setFetchSize(Integer fetchSize)
Specify a desired fetch size to be used with the query. This attribute is applied to the JDBC Statement used to execute the query. Note that some JDBC drivers may not support this attribute.
Parameters:
fetchSize - is an Integer containing the desired fetch size to be used with the query.

getFetchSize

public Integer getFetchSize()
Get the FetchSize attribute for the query. This method will return null if the attribute hasn't been set. If the attribute is not set, the JDBC statement will use a default value.
Returns:
an Integer value, may be null.

setFetchDirection

public void setFetchDirection(Integer fetchDirection)
Specify a desired fetch direction to be used with the query. This attribute is applied to the JDBC Statement used to execute the query. Note that some JDBC drivers may not support this attribute. Valid values are as defined by the JDBC api.
Parameters:
fetchDirection - is an Integer containing the desired fetch direction to be used with the query.

getFetchDirection

public Integer getFetchDirection()
Get the FetchDirection attribute for the query. This method will return null if the attribute hasn't been set. If the attribute is not set, the JDBC statement will use a default value.
Returns:
an Integer value, may be null.

setEscapeProcessing

public void setEscapeProcessing(Boolean escapeProcessing)
Specify whether the query should use escape processing. This attribute is applied to the JDBC Statement used to execute the query. Note that some JDBC drivers may not support this attribute.
Parameters:
escapeProcessing - is a Boolean indicating whether the query should use escape processing.

getEscapeProcessing

public Boolean getEscapeProcessing()
Get the EscapeProcessing attribute for the query. This method will return null if the attribute hasn't been set. If the attribute is not set, the JDBC statement will use a default value.
Returns:
a Boolean value, may be null.

setQueryTimeout

public void setQueryTimeout(Integer timeoutSeconds)
Specify a timeout interval to be used with the query. This attribute is applied to the JDBC Statement used to execute the query. Note that some JDBC drivers may not support this attribute.
Parameters:
timeoutSeconds - is an Integer containing the timeout interval in seconds to be used with the query.

getQueryTimeout

public Integer getQueryTimeout()
Get the QueryTimeout attribute for the query. This method will return null if the attribute hasn't been set. If the attribute is not set, the JDBC statement will use a default value.
Returns:
an Integer value, may be null.

setDistinct

public void setDistinct(boolean distinct)
Specify whether the SQL query should use the DISTINCT keyword.
Parameters:
distinct - is a boolean indicating whether the query should use the DISTINCT keyword. The default value is false.

getDistinct

public boolean getDistinct()
Get the Distinct attribute for the query.
Returns:
a boolean value.

getInParameters

public Object[] getInParameters()
Get the In Parameters, if there is any.
Returns:
an array of parameters with propName/propDatatype/propValue for each parameter.

Novell exteNd
Director 5.0 API