Package org.springframework.cloud.task.repository.database.support

# Class AbstractSqlPagingQueryProvider

java.lang.Object
org.springframework.cloud.task.repository.database.support.AbstractSqlPagingQueryProvider

All Implemented Interfaces:
  `PagingQueryProvider`

Direct Known Subclasses:
  `Db2PagingQueryProvider`, `H2PagingQueryProvider`, `HsqlPagingQueryProvider`, `MySqlPagingQueryProvider`, `OraclePagingQueryProvider`, `PostgresPagingQueryProvider`, `SqlServerPagingQueryProvider`

public abstract class AbstractSqlPagingQueryProvider extends Object implements PagingQueryProvider
Abstract SQL Paging Query Provider to serve as a base class for all provided SQL paging query providers. Any implementation must provide a way to specify the select clause, from clause and optionally a where clause. It is recommended that there should be an index for the sort key to provide better performance. Provides properties and preparation for the mandatory "selectClause" and "fromClause" as well as for the optional "whereClause".

Author:
  Glenn Renfro

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractSqlPagingQueryProvider()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String`
  `getFromClause()`
  `int`
  `getParameterCount()`
  The number of parameters that are declared in the query.
  `protected String`
  `getSelectClause()`
  `Map<String,org.springframework.batch.item.database.Order>`
  `getSortKeys()`
  A Map<String, Order> of sort columns as the key and `Order` for ascending/descending.
  `protected String`
  `getWhereClause()`
  `void`
  `init(DataSource dataSource)`
  Initialize the query provider using the provided `DataSource` if necessary.
  `boolean`
  `isUsingNamedParameters()`
  Indicate whether the generated queries use named parameter syntax.
  `void`
  `setFromClause(String fromClause)`
  `void`
  `setSelectClause(String selectClause)`
  `void`
  `setSortKeys(Map<String,org.springframework.batch.item.database.Order> sortKeys)`
  `void`
  `setWhereClause(String whereClause)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.springframework.cloud.task.repository.database.PagingQueryProvider

  `getPageQuery`

- ## Constructor Details

  - ### AbstractSqlPagingQueryProvider

    public AbstractSqlPagingQueryProvider()

- ## Method Details

  - ### getSelectClause

    protected String getSelectClause()
    Returns:
      SQL SELECT clause part of SQL query string

  - ### setSelectClause

    public void setSelectClause(String selectClause)
    Parameters:
      `selectClause` - SELECT clause part of SQL query string

  - ### getFromClause

    protected String getFromClause()
    Returns:
      SQL FROM clause part of SQL query string

  - ### setFromClause

    public void setFromClause(String fromClause)
    Parameters:
      `fromClause` - FROM clause part of SQL query string

  - ### getWhereClause

    protected String getWhereClause()
    Returns:
      SQL WHERE clause part of SQL query string

  - ### setWhereClause

    public void setWhereClause(String whereClause)
    Parameters:
      `whereClause` - WHERE clause part of SQL query string

  - ### getSortKeys

    public Map<String,org.springframework.batch.item.database.Order> getSortKeys()
    A Map<String, Order> of sort columns as the key and `Order` for ascending/descending.
    Specified by:
      `getSortKeys` in interface `PagingQueryProvider`
    Returns:
      sortKey key to use to sort and limit page content

  - ### setSortKeys

    public void setSortKeys(Map<String,org.springframework.batch.item.database.Order> sortKeys)
    Parameters:
      `sortKeys` - key to use to sort and limit page content

  - ### getParameterCount

    public int getParameterCount()
    Description copied from interface: `PagingQueryProvider`
    The number of parameters that are declared in the query.
    Specified by:
      `getParameterCount` in interface `PagingQueryProvider`
    Returns:
      number of parameters

  - ### isUsingNamedParameters

    public boolean isUsingNamedParameters()
    Description copied from interface: `PagingQueryProvider`
    Indicate whether the generated queries use named parameter syntax.
    Specified by:
      `isUsingNamedParameters` in interface `PagingQueryProvider`
    Returns:
      true if named parameter syntax is used

  - ### init

    public void init(DataSource dataSource) throws Exception
    Description copied from interface: `PagingQueryProvider`
    Initialize the query provider using the provided `DataSource` if necessary.
    Specified by:
      `init` in interface `PagingQueryProvider`
    Parameters:
      `dataSource` - DataSource to use for any initialization
    Throws:
      `Exception` - throws `Exception` if query provider initialize fails.