com.googlecode.flyway.core.dbsupport.h2
Class H2DbSupport

java.lang.Object
  extended by com.googlecode.flyway.core.dbsupport.h2.H2DbSupport
All Implemented Interfaces:
DbSupport

public class H2DbSupport
extends java.lang.Object
implements DbSupport

H2 database specific support


Constructor Summary
H2DbSupport(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
          Creates a new instance.
 
Method Summary
 boolean columnExists(java.lang.String table, java.lang.String column)
          Checks whether this column is already present in this table in the database.
 SqlScript createCleanScript()
          Creates a new sql script which clean the current schema, by dropping all objects.
 SqlScript createSqlScript(java.lang.String sqlScriptSource, PlaceholderReplacer placeholderReplacer)
          Creates a new sql script from this resource with these placeholders to replace.
 java.lang.String getBooleanFalse()
           
 java.lang.String getBooleanTrue()
           
 java.lang.String getCurrentSchema()
          Retrieves the current schema.
 java.lang.String getCurrentUserFunction()
           
 java.lang.String getScriptLocation()
          Returns the location on the classpath where the scripts for this database reside.
 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.
 boolean tableExists(java.lang.String table)
          Checks whether this table is already present in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

H2DbSupport

public H2DbSupport(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Creates a new instance.

Parameters:
jdbcTemplate - The jdbcTemplate to use.
Method Detail

getScriptLocation

public java.lang.String getScriptLocation()
Description copied from interface: DbSupport
Returns the location on the classpath where the scripts for this database reside.

Specified by:
getScriptLocation in interface DbSupport
Returns:
The folder on the classpath, including a trailing slash.

getCurrentUserFunction

public java.lang.String getCurrentUserFunction()
Specified by:
getCurrentUserFunction in interface DbSupport
Returns:
The database function that returns the current user.

getCurrentSchema

public java.lang.String getCurrentSchema()
Description copied from interface: DbSupport
Retrieves the current schema.

Specified by:
getCurrentSchema in interface DbSupport
Returns:
The current schema for this connection.

tableExists

public boolean tableExists(java.lang.String table)
Description copied from interface: DbSupport
Checks whether this table is already present in the database.

Specified by:
tableExists in interface DbSupport
Parameters:
table - The table to look for.
Returns:
true if the table exists, false if it doesn't.

columnExists

public boolean columnExists(java.lang.String table,
                            java.lang.String column)
Description copied from interface: DbSupport
Checks whether this column is already present in this table in the database.

Specified by:
columnExists in interface DbSupport
Parameters:
table - The table to look for.
column - The column to look for.
Returns:
true if the table exists, false if it doesn't.

supportsDdlTransactions

public boolean supportsDdlTransactions()
Description copied from interface: DbSupport
Checks whether ddl transactions are supported for this database.

Specified by:
supportsDdlTransactions in interface DbSupport
Returns:
true if ddl transactions are supported, false if not.

supportsLocking

public boolean supportsLocking()
Description copied from interface: DbSupport
Checks whether locking using select ... for update is supported for this database.

Specified by:
supportsLocking in interface DbSupport
Returns:
true if locking is supported, false if not.

getBooleanTrue

public java.lang.String getBooleanTrue()
Specified by:
getBooleanTrue in interface DbSupport
Returns:
The representation of the value true in a boolean column.

getBooleanFalse

public java.lang.String getBooleanFalse()
Specified by:
getBooleanFalse in interface DbSupport
Returns:
The representation of the value false in a boolean column.

createSqlScript

public SqlScript createSqlScript(java.lang.String sqlScriptSource,
                                 PlaceholderReplacer placeholderReplacer)
Description copied from interface: DbSupport
Creates a new sql script from this resource with these placeholders to replace.

Specified by:
createSqlScript in interface DbSupport
Parameters:
sqlScriptSource - The sql script as a text block with all placeholders still present.
placeholderReplacer - The placeholder replacer to apply to sql migration scripts.
Returns:
A new sql script, containing the statements from this resource, with all placeholders replaced.

createCleanScript

public SqlScript createCleanScript()
Description copied from interface: DbSupport
Creates a new sql script which clean the current schema, by dropping all objects.

Specified by:
createCleanScript in interface DbSupport
Returns:
A new sql script, containing drop statements for all objects


Copyright © 2010. All Rights Reserved.