com.vaadin.data.util.sqlcontainer.query.generator
Interface SQLGenerator

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultSQLGenerator, MSSQLGenerator, OracleGenerator

public interface SQLGenerator
extends Serializable

The SQLGenerator interface is meant to be implemented for each different SQL syntax that is to be supported. By default there are implementations for HSQLDB, MySQL, PostgreSQL, MSSQL and Oracle syntaxes.

Author:
Jonatan Kronqvist / Vaadin Ltd

Method Summary
 StatementHelper generateDeleteQuery(String tableName, List<String> primaryKeyColumns, String versionColumn, RowItem item)
          Generates a DELETE query for deleting data related to the given RowItem from the database.
 StatementHelper generateInsertQuery(String tableName, RowItem item)
          Generates an INSERT query for inserting a new row with the provided values.
 StatementHelper generateSelectQuery(String tableName, List<Container.Filter> filters, List<OrderBy> orderBys, int offset, int pagelength, String toSelect)
          Generates a SELECT query with the provided parameters.
 StatementHelper generateUpdateQuery(String tableName, RowItem item)
          Generates an UPDATE query with the provided parameters.
 

Method Detail

generateSelectQuery

StatementHelper generateSelectQuery(String tableName,
                                    List<Container.Filter> filters,
                                    List<OrderBy> orderBys,
                                    int offset,
                                    int pagelength,
                                    String toSelect)
Generates a SELECT query with the provided parameters. Uses default filtering mode (INCLUSIVE).

Parameters:
tableName - Name of the table queried
filters - The filters, converted into a WHERE clause
orderBys - The the ordering conditions, converted into an ORDER BY clause
offset - The offset of the first row to be included
pagelength - The number of rows to be returned when the query executes
toSelect - String containing what to select, e.g. "*", "COUNT(*)"
Returns:
StatementHelper instance containing the query string for a PreparedStatement and the values required for the parameters

generateUpdateQuery

StatementHelper generateUpdateQuery(String tableName,
                                    RowItem item)
Generates an UPDATE query with the provided parameters.

Parameters:
tableName - Name of the table queried
item - RowItem containing the updated values update.
Returns:
StatementHelper instance containing the query string for a PreparedStatement and the values required for the parameters

generateInsertQuery

StatementHelper generateInsertQuery(String tableName,
                                    RowItem item)
Generates an INSERT query for inserting a new row with the provided values.

Parameters:
tableName - Name of the table queried
item - New RowItem to be inserted into the database.
Returns:
StatementHelper instance containing the query string for a PreparedStatement and the values required for the parameters

generateDeleteQuery

StatementHelper generateDeleteQuery(String tableName,
                                    List<String> primaryKeyColumns,
                                    String versionColumn,
                                    RowItem item)
Generates a DELETE query for deleting data related to the given RowItem from the database.

Parameters:
tableName - Name of the table queried
primaryKeyColumns - the names of the columns holding the primary key. Usually just one column, but might be several.
versionColumn - the column containing the version number of the row, null if versioning (optimistic locking) not enabled.
item - Item to be deleted from the database
Returns:
StatementHelper instance containing the query string for a PreparedStatement and the values required for the parameters


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.