org.qi4j.index.sql.support.api

## Interface SQLQuerying

- All Known Subinterfaces:
    PostgreSQLService
  All Known Implementing Classes:
    AbstractSQLQuerying, PostgreSQLQuerying

      public interface SQLQuerying

  This interface provides parsing support from Zest queries to SQL queries. The idea is that this interface produces SQL which can be used when creating a `PreparedStatement`.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `constructQuery(Class<?> resultType, Specification<Composite> whereClause, OrderBy[] orderBySegments, Integer firstResult, Integer maxResults, Map<String,Object> variables, List<Object> values, List<Integer> valueSqlTypes, Boolean countOnly)` This method will be called when parsing needs to be done from Zest query to SQL query.
    `Integer` | `getResultSetType(Integer firstResult, Integer maxResults)`
    `Boolean` | `isFirstResultSettingSupported()`

- - ### Method Detail

    - #### constructQuery

          String constructQuery(Class<?> resultType,
                              @Optional
                              Specification<Composite> whereClause,
                              @Optional
                              OrderBy[] orderBySegments,
                              @Optional
                              Integer firstResult,
                              @Optional
                              Integer maxResults,
                              Map<String,Object> variables,
                              List<Object> values,
                              List<Integer> valueSqlTypes,
                              Boolean countOnly)
                                throws EntityFinderException

      This method will be called when parsing needs to be done from Zest query to SQL query. This method is supposed to return one single SQL query, which can be used with `PreparedStatement`.
      Parameters:
        `resultType` - The result type of Zest query.
        `whereClause` - The where clause of Zest query.
        `orderBySegments` - The order by segments of Zest query.
        `firstResult` - The first result index of Zest query.
        `maxResults` - The max amount of returned results.
        `values` - Values to put into `PreparedStatement`, in the order of the list. This List is created from the outside and this method is supposed to fill it with necessary values, if any.
        `valueSqlTypes` - The SQL types of the objects in `values`. Each SQL type at index `x` is interpreted as type of value at index `x` of the `values` -list.
        `countOnly` - True if this query should return only the number of matching entities, false otherwise.
      Returns:
        The SQL query, which may be used with `PreparedStatement`.
      Throws:
        `EntityFinderException` - If SQLException or something else bad happens.

    - #### isFirstResultSettingSupported

          Boolean isFirstResultSettingSupported()

    - #### getResultSetType

          Integer getResultSetType(@Optional
                                 Integer firstResult,
                                 @Optional
                                 Integer maxResults)