com.google.code.flyway.core.dbsupport
Interface DbSupport

All Known Implementing Classes:
H2DbSupport, HsqlDbSupport, MySQLDbSupport, OracleDbSupport

public interface DbSupport

Abstraction for database-specific functionality.


Method Summary
 SqlScript createCleanScript(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
          Creates a new sql script which clean the current schema, by dropping all objects.
 java.lang.String[] createSchemaMetaDataTableSql(java.lang.String tableName)
          Generates the sql statements for creating the schema meta-data table.
 SqlScript createSqlScript(org.springframework.core.io.Resource resource, java.util.Map<java.lang.String,java.lang.String> placeholders)
          Creates a new sql script from this resource with these placeholders to replace.
 java.lang.String getCurrentSchema(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
          Retrieves the current schema.
 boolean metaDataTableExists(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, java.lang.String schemaMetaDataTable)
          Checks whether Flyway's metadata table is already present in the database.
 boolean supportsDatabase(java.lang.String databaseProductName)
          Checks whether this DbSupport class supports the database with this product name.
 boolean supportsDdlTransactions()
          Checks whether ddl transactions are supported for this database.
 boolean supportsLocking()
          Checks whether locking using select ... for update is supported for this database.
 

Method Detail

createSchemaMetaDataTableSql

java.lang.String[] createSchemaMetaDataTableSql(java.lang.String tableName)
Generates the sql statements for creating the schema meta-data table.

Parameters:
tableName - The name to give to this table.
Returns:
The sql statements.

getCurrentSchema

java.lang.String getCurrentSchema(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Retrieves the current schema.

Parameters:
jdbcTemplate - The jdbc template used for querying the database.
Returns:
The current schema for this connection.

supportsDatabase

boolean supportsDatabase(java.lang.String databaseProductName)
Checks whether this DbSupport class supports the database with this product name.

Parameters:
databaseProductName - The name of the database.
Returns:
true if the database is supported, false if not.

metaDataTableExists

boolean metaDataTableExists(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                            java.lang.String schemaMetaDataTable)
Checks whether Flyway's metadata table is already present in the database.

Parameters:
jdbcTemplate - The jdbc template used for querying the database.
schemaMetaDataTable - The table to look for.
Returns:
true if the table exists, false if it doesn't.

supportsDdlTransactions

boolean supportsDdlTransactions()
Checks whether ddl transactions are supported for this database.

Returns:
true if ddl transactions are supported, false if not.

supportsLocking

boolean supportsLocking()
Checks whether locking using select ... for update is supported for this database.

Returns:
true if locking is supported, false if not.

createSqlScript

SqlScript createSqlScript(org.springframework.core.io.Resource resource,
                          java.util.Map<java.lang.String,java.lang.String> placeholders)
Creates a new sql script from this resource with these placeholders to replace.

Parameters:
resource - The resource containing the sql script.
placeholders - A map of to replace in sql statements.
Returns:
A new sql script, containing the statements from this resource, with all placeholders replaced.
Throws:
java.lang.IllegalStateException - Thrown when the script could not be read from this resource.

createCleanScript

SqlScript createCleanScript(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Creates a new sql script which clean the current schema, by dropping all objects.

Parameters:
jdbcTemplate - The jdbc template used for querying the database.
Returns:
A new sql script, containing drop statements for all objects


Copyright © 2010. All Rights Reserved.