org.araneaframework.backend.list.helper
Class PostgreListSqlHelper

java.lang.Object
  extended byorg.araneaframework.backend.list.helper.BaseListSqlHelper
      extended byorg.araneaframework.backend.list.helper.ListSqlHelper
          extended byorg.araneaframework.backend.list.helper.PostgreListSqlHelper

public class PostgreListSqlHelper
extends ListSqlHelper

Extends the ListSqLHelper to support PostgreSQL database queries.

Since:
1.1.3
Author:
Roman Tekhov

Nested Class Summary
 
Nested classes inherited from class org.araneaframework.backend.list.helper.BaseListSqlHelper
BaseListSqlHelper.BeanResultReader, BaseListSqlHelper.CountSqlCallback, BaseListSqlHelper.ItemRangeSqlCallback, BaseListSqlHelper.ListItemsDataCallback
 
Field Summary
protected  String countSqlQuery
           
protected  SqlStatement statement
           
 
Fields inherited from class org.araneaframework.backend.list.helper.ListSqlHelper
converterBasedColumnReader, log, mappingNamingStrategyAndFields, prefixMapNamingStrategy, standardFields, standardValueConverter
 
Fields inherited from class org.araneaframework.backend.list.helper.BaseListSqlHelper
DEFAULT_RANGE_START, ds, fields, filterExpr, filterSqlExpr, itemRangeCount, itemRangeStart, namingStrategy, orderExpr, orderSqlExpr, resultSetColumnReader, valueConverter, variableResolver
 
Constructor Summary
PostgreListSqlHelper()
           
PostgreListSqlHelper(DataSource dataSource)
           
PostgreListSqlHelper(DataSource dataSource, ListQuery query)
           
PostgreListSqlHelper(ListQuery query)
           
 
Method Summary
 void addNullParam(int valueType)
          Adds a NULL PreparedStatement parameter for later setting.
 void addStatementParam(Object param)
          Adds a PreparedStatement parameter for later setting.
 void addStatementParams(List params)
          Adds PreparedStatement parameters for later setting.
protected  StandardExpressionToSqlExprBuilder createFilterSqlExpressionBuilder()
          Creates new filtering SQL Expression builder.
protected  SqlStatement getCountSqlStatement()
          Returns the total count SQL query String and parameters.
protected  SqlExpression getFieldsSqlExpression()
          Returns the fields SqlExpression, which can be used in "SELECT" clause.
protected  SqlStatement getRangeSqlStatement()
          Returns the itme range SQL query String and parameters.
 void setCountSqlQuery(String countSqlQuery)
          Sets the SQL query used to count the items in the database.
 void setSqlQuery(String sqlQuery)
          Sets the SQL query that will be used to retrieve the item range from the list and count the items.
 
Methods inherited from class org.araneaframework.backend.list.helper.ListSqlHelper
addDatabaseFieldConverter, addDatabaseFieldMapping, addDatabaseFieldMapping, addFields, addMapping, addMapping, addNamingStrategy, addNamingStrategy, addNamingStrategyAsFirst, addResultSetDeconverterForBeanField, addResultSetDeconverterForColumn, addResultSetMapping, getConverterBasedColumnReader, getMappingNamingStrategyAndFields, getPrefixMapNamingStrategy, getStandardFields, getStandardValueConverter, init, setConverterBasedColumnReader, setMappingNamingStrategyAndFields, setPrefixMapNamingStrategy, setStandardFields, setStandardValueConverter
 
Methods inherited from class org.araneaframework.backend.list.helper.BaseListSqlHelper
createBeanResultReader, createExpressionBuilderResolver, createOrderSqlExpressionBuilder, createQueryFailedException, execute, execute, execute, executeCountSql, executeItemRangeSql, executeItemRangeSql, getCountSqlCallback, getDatabaseFields, getDatabaseFilter, getDatabaseFilterParams, getDatabaseFilterWith, getDatabaseOrder, getDatabaseOrderParams, getDatabaseOrderWith, getFields, getFilterSqlExpression, getItemRangeSqlCallback, getListItemsDataCallback, getNamingStrategy, getOrderSqlExpression, getResultSetColumnReader, getValueConverter, setDataSource, setFields, setFilterExpression, setItemRangeCount, setItemRangeStart, setListQuery, setNamingStrategy, setOrderExpression, setResultSetColumnReader, setSimpleSqlQuery, setSimpleSqlQuery, setSimpleSqlQuery, setValueConverter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statement

protected SqlStatement statement

countSqlQuery

protected String countSqlQuery
Constructor Detail

PostgreListSqlHelper

public PostgreListSqlHelper(DataSource dataSource,
                            ListQuery query)

PostgreListSqlHelper

public PostgreListSqlHelper(DataSource dataSource)

PostgreListSqlHelper

public PostgreListSqlHelper(ListQuery query)

PostgreListSqlHelper

public PostgreListSqlHelper()
Method Detail

getCountSqlStatement

protected SqlStatement getCountSqlStatement()
Description copied from class: BaseListSqlHelper
Returns the total count SQL query String and parameters.

Specified by:
getCountSqlStatement in class BaseListSqlHelper

getRangeSqlStatement

protected SqlStatement getRangeSqlStatement()
Description copied from class: BaseListSqlHelper
Returns the itme range SQL query String and parameters.

Specified by:
getRangeSqlStatement in class BaseListSqlHelper

getFieldsSqlExpression

protected SqlExpression getFieldsSqlExpression()
Description copied from class: BaseListSqlHelper
Returns the fields SqlExpression, which can be used in "SELECT" clause.

Overrides:
getFieldsSqlExpression in class BaseListSqlHelper
Returns:
the fields SqlExpression, which can be used in "SELECT" clause.

createFilterSqlExpressionBuilder

protected StandardExpressionToSqlExprBuilder createFilterSqlExpressionBuilder()
Description copied from class: BaseListSqlHelper
Creates new filtering SQL Expression builder.

Overrides:
createFilterSqlExpressionBuilder in class BaseListSqlHelper

setCountSqlQuery

public void setCountSqlQuery(String countSqlQuery)
Description copied from class: BaseListSqlHelper
Sets the SQL query used to count the items in the database. SQL query must start with SELECT.

By default, total items count and items range queries are constructed automatically based on the original query. This method should only be used, if it can considerably boost the perfomacne of count query.

Specified by:
setCountSqlQuery in class BaseListSqlHelper
Parameters:
countSqlQuery - the SQL query used to count the items in the database.

setSqlQuery

public void setSqlQuery(String sqlQuery)
Description copied from class: BaseListSqlHelper
Sets the SQL query that will be used to retrieve the item range from the list and count the items. SQL query must start with SELECT. All query arguments must be added additionally.

ListQuery filter and order conditions are not added automatically. To add them, use getDatabaseFilter* and getDatabaseOrder* methods.

For simpler cases, use one of the setSimpleSqlQuery methods instead.

Specified by:
setSqlQuery in class BaseListSqlHelper
Parameters:
sqlQuery - the SQL query that will be used to retrieve the item range from the list and count the items.

addNullParam

public void addNullParam(int valueType)
Description copied from class: BaseListSqlHelper
Adds a NULL PreparedStatement parameter for later setting.

This method should not be used with one of the setSimpleSqlQuery methods.

Specified by:
addNullParam in class BaseListSqlHelper
Parameters:
valueType - the type of the NULL value.

addStatementParam

public void addStatementParam(Object param)
Description copied from class: BaseListSqlHelper
Adds a PreparedStatement parameter for later setting.

This method should not be used with one of the setSimpleSqlQuery methods.

Specified by:
addStatementParam in class BaseListSqlHelper
Parameters:
param - a PreparedStatement parameter.

addStatementParams

public void addStatementParams(List params)
Description copied from class: BaseListSqlHelper
Adds PreparedStatement parameters for later setting.

This method should not be used with one of the setSimpleSqlQuery methods.

Specified by:
addStatementParams in class BaseListSqlHelper
Parameters:
params - PreparedStatement parameters.