com.vaadin.data.util.sqlcontainer.query.generator.
Interface SQLGenerator
-
All Superinterfaces:
All Known Implementing Classes:
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
All Methods Modifier and Type Method Description 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 queriedfilters
- The filters, converted into a WHERE clauseorderBys
- The the ordering conditions, converted into an ORDER BY clauseoffset
- The offset of the first row to be includedpagelength
- The number of rows to be returned when the query executestoSelect
- 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 querieditem
- 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 querieditem
- 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 queriedprimaryKeyColumns
- 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 databaseReturns:
StatementHelper instance containing the query string for a PreparedStatement and the values required for the parameters
-
-