liquibase.database
Class HsqlDatabase

java.lang.Object
  extended by liquibase.database.AbstractDatabase
      extended by liquibase.database.HsqlDatabase
All Implemented Interfaces:
Database, DatabaseObject
Direct Known Subclasses:
H2Database

public class HsqlDatabase
extends AbstractDatabase


Field Summary
 
Fields inherited from class liquibase.database.AbstractDatabase
currentDateTimeFunction, log
 
Constructor Summary
HsqlDatabase()
           
 
Method Summary
 java.lang.String convertRequestedSchemaToSchema(java.lang.String requestedSchema)
           
 DatabaseSnapshot createDatabaseSnapshot(java.lang.String schema, java.util.Set<DiffStatusListener> statusListeners)
           
 SqlStatement createFindSequencesSQL(java.lang.String schema)
           
 java.lang.String escapeColumnName(java.lang.String schemaName, java.lang.String tableName, java.lang.String columnName)
          Escapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e.
 java.lang.String escapeTableName(java.lang.String schemaName, java.lang.String tableName)
          Escapes the table name in a database-dependent manner so reserved words can be used as a table name (i.e.
 java.lang.String getAutoIncrementClause()
          Returns database-specific auto-increment DDL clause.
 java.lang.String getBlobType()
          Returns the actual database-specific data type to use a "BLOB" column.
 java.lang.String getBooleanType()
          Returns the actual database-specific data type to use a "boolean" column.
 java.lang.String getClobType()
          Returns the actual database-specific data type to use a "CLOB" column.
 java.lang.String getConcatSql(java.lang.String... values)
          Returns SQL to concat the passed values.
 java.lang.String getCurrencyType()
          Returns the actual database-specific data type to use a "currency" column.
 java.lang.String getCurrentDateTimeFunction()
          Returns database-specific function for generating the current date/time.
 java.lang.String getDateLiteral(java.lang.String isoDate)
          Return a date literal with the same value as a string formatted using ISO 8601.
 java.lang.String getDateTimeType()
          Returns the actual database-specific data type to use a "datetime" column.
protected  java.lang.String getDefaultDatabaseSchemaName()
           
 java.lang.String getDefaultDriver(java.lang.String url)
          If this database understands the given url, return the default driver class name.
 java.lang.String getProductName()
          Returns the full database product name.
 java.lang.String getTypeName()
          Returns an all-lower-case short name of the product.
 java.lang.String getUUIDType()
          Returns the actual database-specific data type to use a "UUID" column.
 SqlStatement getViewDefinitionSql(java.lang.String schemaName, java.lang.String name)
           
 boolean isCorrectDatabaseImplementation(java.sql.Connection conn)
          Is this AbstractDatabase subclass the correct one to use for the given connection.
protected  java.util.Date parseDate(java.lang.String dateAsString)
           
 void setConnection(java.sql.Connection conn)
           
 boolean supportsInitiallyDeferrableColumns()
          Returns whether this database support initially deferrable columns.
 boolean supportsSequences()
          Does the database type support sequence.
 boolean supportsTablespaces()
           
 
Methods inherited from class liquibase.database.AbstractDatabase
canCreateChangeLogTable, checkDatabaseChangeLogLockTable, checkDatabaseChangeLogTable, close, commit, convertDatabaseValueToJavaObject, convertJavaObjectToString, convertRequestedSchemaToCatalog, convertToCorrectJavaType, doesChangeLogLockTableExist, doesChangeLogTableExist, doesTagExist, dropDatabaseObjects, equals, escapeColumnNameList, escapeConstraintName, escapeIndexName, escapeSequenceName, escapeStringForDatabase, escapeViewName, generatePrimaryKeyName, getAutoCommitMode, getBigIntType, getCharType, getColumnType, getColumnType, getConnection, getConnectionURL, getConnectionUsername, getCreateChangeLogLockSQL, getCreateChangeLogSQL, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseProductName, getDatabaseProductName, getDatabaseProductVersion, getDatabaseType, getDateLiteral, getDateLiteral, getDateLiteral, getDateLiteral, getDateType, getDefaultCatalogName, getDefaultSchemaName, getDoubleType, getDriverName, getFalseBooleanValue, getFloatType, getIntType, getJdbcTemplate, getLineComment, getObjectEscapeCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRunStatus, getSelectChangeLogLockSQL, getSystemTablesAndViews, getTimeType, getTinyIntType, getTrueBooleanValue, getVarcharType, getViewDefinition, hashCode, isAutoCommit, isColumnAutoIncrement, isDateOnly, isDateTime, isLiquibaseTable, isLocalDatabase, isSystemTable, isSystemView, isTimeOnly, markChangeSetAsRan, markChangeSetAsReRan, removeRanStatus, rollback, setAutoCommit, setConnection, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultSchemaName, setJdbcTemplate, shouldQuoteValue, supportsAutoIncrement, supportsDDLInTransaction, supportsRestrictForeignKeys, supportsSchemas, tag, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HsqlDatabase

public HsqlDatabase()
Method Detail

isCorrectDatabaseImplementation

public boolean isCorrectDatabaseImplementation(java.sql.Connection conn)
                                        throws JDBCException
Description copied from interface: Database
Is this AbstractDatabase subclass the correct one to use for the given connection.

Throws:
JDBCException

getDefaultDriver

public java.lang.String getDefaultDriver(java.lang.String url)
Description copied from interface: Database
If this database understands the given url, return the default driver class name. Otherwise return null.


getProductName

public java.lang.String getProductName()
Description copied from interface: Database
Returns the full database product name. May be different than what the JDBC connection reports (getDatabaseProductName())


getTypeName

public java.lang.String getTypeName()
Description copied from interface: Database
Returns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition.


supportsSequences

public boolean supportsSequences()
Description copied from class: AbstractDatabase
Does the database type support sequence.

Specified by:
supportsSequences in interface Database
Overrides:
supportsSequences in class AbstractDatabase

supportsInitiallyDeferrableColumns

public boolean supportsInitiallyDeferrableColumns()
Description copied from interface: Database
Returns whether this database support initially deferrable columns.


getDefaultDatabaseSchemaName

protected java.lang.String getDefaultDatabaseSchemaName()
                                                 throws JDBCException
Overrides:
getDefaultDatabaseSchemaName in class AbstractDatabase
Throws:
JDBCException

getBooleanType

public java.lang.String getBooleanType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "boolean" column.


getCurrencyType

public java.lang.String getCurrencyType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "currency" column.


getUUIDType

public java.lang.String getUUIDType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "UUID" column.


getClobType

public java.lang.String getClobType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "CLOB" column.


getBlobType

public java.lang.String getBlobType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "BLOB" column.


getDateTimeType

public java.lang.String getDateTimeType()
Description copied from interface: Database
Returns the actual database-specific data type to use a "datetime" column.


getCurrentDateTimeFunction

public java.lang.String getCurrentDateTimeFunction()
Description copied from interface: Database
Returns database-specific function for generating the current date/time.


getAutoIncrementClause

public java.lang.String getAutoIncrementClause()
Description copied from class: AbstractDatabase
Returns database-specific auto-increment DDL clause.

Specified by:
getAutoIncrementClause in interface Database
Overrides:
getAutoIncrementClause in class AbstractDatabase

getConcatSql

public java.lang.String getConcatSql(java.lang.String... values)
Description copied from interface: Database
Returns SQL to concat the passed values.

Specified by:
getConcatSql in interface Database
Overrides:
getConcatSql in class AbstractDatabase

getDateLiteral

public java.lang.String getDateLiteral(java.lang.String isoDate)
Description copied from class: AbstractDatabase
Return a date literal with the same value as a string formatted using ISO 8601.

Note: many databases accept date literals in ISO8601 format with the 'T' replaced with a space. Only databases which do not accept these strings should need to override this method.

Implementation restriction: Currently, only the following subsets of ISO8601 are supported: yyyy-MM-dd hh:mm:ss yyyy-MM-ddThh:mm:ss

Specified by:
getDateLiteral in interface Database
Overrides:
getDateLiteral in class AbstractDatabase

parseDate

protected java.util.Date parseDate(java.lang.String dateAsString)
                            throws DateParseException
Overrides:
parseDate in class AbstractDatabase
Throws:
DateParseException

createFindSequencesSQL

public SqlStatement createFindSequencesSQL(java.lang.String schema)
                                    throws JDBCException
Specified by:
createFindSequencesSQL in interface Database
Overrides:
createFindSequencesSQL in class AbstractDatabase
Throws:
JDBCException

supportsTablespaces

public boolean supportsTablespaces()

setConnection

public void setConnection(java.sql.Connection conn)
Specified by:
setConnection in interface Database
Overrides:
setConnection in class AbstractDatabase

getViewDefinitionSql

public SqlStatement getViewDefinitionSql(java.lang.String schemaName,
                                         java.lang.String name)
                                  throws JDBCException
Overrides:
getViewDefinitionSql in class AbstractDatabase
Throws:
JDBCException

convertRequestedSchemaToSchema

public java.lang.String convertRequestedSchemaToSchema(java.lang.String requestedSchema)
                                                throws JDBCException
Specified by:
convertRequestedSchemaToSchema in interface Database
Overrides:
convertRequestedSchemaToSchema in class AbstractDatabase
Throws:
JDBCException

createDatabaseSnapshot

public DatabaseSnapshot createDatabaseSnapshot(java.lang.String schema,
                                               java.util.Set<DiffStatusListener> statusListeners)
                                        throws JDBCException
Specified by:
createDatabaseSnapshot in interface Database
Specified by:
createDatabaseSnapshot in class AbstractDatabase
Throws:
JDBCException

escapeTableName

public java.lang.String escapeTableName(java.lang.String schemaName,
                                        java.lang.String tableName)
Description copied from interface: Database
Escapes the table name in a database-dependent manner so reserved words can be used as a table name (i.e. "order"). Currently only escapes MS-SQL because other DBMSs store table names case-sensitively when escaping is used which could confuse end-users. Pass null to schemaName to use the default schema

Specified by:
escapeTableName in interface Database
Overrides:
escapeTableName in class AbstractDatabase

escapeColumnName

public java.lang.String escapeColumnName(java.lang.String schemaName,
                                         java.lang.String tableName,
                                         java.lang.String columnName)
Description copied from interface: Database
Escapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e. "return").

Specified by:
escapeColumnName in interface Database
Overrides:
escapeColumnName in class AbstractDatabase
columnName - column name
Returns:
escaped column name