ca.krasnay.sqlbuilder
Interface Dialect

All Known Implementing Classes:
PostgresqlDialect

public interface Dialect

Interface representing a SQL dialect. Dialects can modify SQL queries in database server-specific ways.

Author:
John Krasnay

Method Summary
 String createCountSelect(String sql)
          Returns a SQL statement that returns the number of rows that would be returned by another select.
 String createPageSelect(String sql, int limit, int offset)
          Returns a SQL statement that returns a limited number of rows from an inner query.
 

Method Detail

createCountSelect

String createCountSelect(String sql)
Returns a SQL statement that returns the number of rows that would be returned by another select.

Parameters:
sql - Inner select statement, i.e. the one that returns the rows themselves.

createPageSelect

String createPageSelect(String sql,
                        int limit,
                        int offset)
Returns a SQL statement that returns a limited number of rows from an inner query. Note that the inner select should include an ORDER BY clause that strictly orders the result set; otherwise, some database servers may return pages inconsistently.

Parameters:
sql - Inner query that would return the full result set.
limit - Maximum number of rows to return.
offset - Index into the result set of the first row returned.


Copyright © 2014. All rights reserved.