Top Fields Constructors Methods
liquibase.database.core

public Class H2Database

extends AbstractJdbcDatabase
Class Inheritance
Known Direct Subclasses
liquibase.diff.output.DiffOutputControl.DatabaseForHash
Imports
liquibase.CatalogAndSchema, .CatalogAndSchema.CatalogAndSchemaCase, .GlobalConfiguration, .Scope, liquibase.database.AbstractJdbcDatabase, .DatabaseConnection, .ObjectQuotingStrategy, .OfflineConnection, liquibase.database.jvm.JdbcConnection, liquibase.exception.DatabaseException, .DateParseException, .UnexpectedLiquibaseException, liquibase.statement.DatabaseFunction, liquibase.structure.DatabaseObject, liquibase.structure.core.Table, liquibase.util.ISODateFormat, .JdbcUtil, java.lang.reflect.Method, java.math.BigInteger, java.sql.Connection, .ResultSet, .SQLException, .Statement, java.text.ParseException, java.util.Arrays, .Collections, .Date, .LinkedHashSet, .List, .Locale, .Set, java.util.regex.Matcher, .Pattern

Field Summary

Modifier and TypeField and Description
private static final int
private String
private static final String
private static final int
private static final int
private static final Pattern
private static final String
private static final String
private static final String
protected static final Set<String>
protected static final Set<String>
Inherited from liquibase.database.AbstractJdbcDatabase:
caseSensitivecurrentDateTimeFunctiondateFunctionsdefaultAutoIncrementBydefaultAutoIncrementStartWithdefaultCatalogNamedefaultSchemaNamequotingStrategysequenceCurrentValueFunctionsequenceNextValueFunctionunmodifiableDataTypesunquotedObjectsAreUppercased

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
correctObjectName(String objectName, Class<? extends DatabaseObject> objectType)

Overrides liquibase.database.AbstractJdbcDatabase.correctObjectName.

Implements liquibase.database.Database.correctObjectName.

Fix the object name to the format the database expects, handling changes in case, etc.

public boolean
public String
protected String
protected String
public String
getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull)

Overrides liquibase.database.AbstractJdbcDatabase.getAutoIncrementClause.

Implements liquibase.database.Database.getAutoIncrementClause.

Returns database-specific auto-increment DDL clause.

protected String
private int
public String
getConcatSql(String... values)

Overrides liquibase.database.AbstractJdbcDatabase.getConcatSql.

Implements liquibase.database.Database.getConcatSql.

Returns SQL to concat the passed values.

private String

Returns:

a String containing the CONCAT instruction with all elements, or only a value if there is only one element in the list
getConcatSql
(List<String>
a non null List of String
values
)

Recursive way of building CONCAT instruction

protected String
getConnectionSchemaName()

Overrides liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName.

Overwrite this method to get the default schema name for the connection.

public String
getDateLiteral(String isoDate)

Overrides liquibase.database.AbstractJdbcDatabase.getDateLiteral.

Implements liquibase.database.Database.getDateLiteral.

Return a date literal with the same value as a string formatted using ISO 8601.

protected String
public String
getDefaultDriver(String url)

Implements liquibase.database.Database.getDefaultDriver.

If this database understands the given url, return the default driver class name.

public Integer
public int
getMaxFractionalDigitsForTimestamp()

Overrides liquibase.database.AbstractJdbcDatabase.getMaxFractionalDigitsForTimestamp.

Implements liquibase.database.Database.getMaxFractionalDigitsForTimestamp.

Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.

public int
protected Set<String>
public String
getShortName()

Implements liquibase.database.Database.getShortName.

Returns an all-lower-case short name of the product.

public String
public boolean
isCorrectDatabaseImplementation(DatabaseConnection conn)

Implements liquibase.database.Database.isCorrectDatabaseImplementation.

Is this AbstractDatabase subclass the correct one to use for the given connection.

private boolean
public boolean
public boolean
protected boolean
public Date
public void
public boolean
supportsCreateIfNotExists(Class<? extends DatabaseObject>
the DatabaseObject type to be checked.
type
)

Overrides default liquibase.database.Database.supportsCreateIfNotExists.

Does the database support the "if not exits" syntax?

public boolean
public boolean
supportsInitiallyDeferrableColumns()

Implements liquibase.database.Database.supportsInitiallyDeferrableColumns.

Returns whether this database support initially deferrable columns.

public boolean
public boolean
public boolean
Inherited from liquibase.database.AbstractJdbcDatabase:
addReservedWordscanCreateChangeLogTableclosecommitcorrectSchemacorrectSchemadataTypeIsNotModifiabledisableForeignKeyChecksdoesTagExistdropDatabaseObjectsenableForeignKeyChecksequalsescapeColumnNameescapeColumnNameescapeColumnNameListescapeConstraintNameescapeDataTypeNameescapeIndexNameescapeObjectNameescapeSequenceNameescapeStringForDatabaseescapeTableNameescapeViewNameexecuteexecuteRollbackStatementsexecuteRollbackStatementsexecuteStatementsfilterRollbackVisitorsgenerateAutoIncrementBygenerateAutoIncrementStartWithgenerateDatabaseFunctionValuegeneratePrimaryKeyNamegetgetAutoCommitModegetAutoIncrementClausegetAutoIncrementClosinggetAutoIncrementOpeninggetConnectiongetConnectionCatalogNamegetConnectionSchemaNameCallStatementgetContainingObjectsgetCurrentDateTimeFunctiongetDatabaseChangeLogLockTableNamegetDatabaseChangeLogTableNamegetDatabaseMajorVersiongetDatabaseMinorVersiongetDatabaseProductNamegetDatabaseProductVersiongetDataTypeMaxParametersgetDateFunctionsgetDateLiteralgetDateLiteralgetDateTimeLiteralgetDefaultCatalogNamegetDefaultFractionalDigitsForTimestampgetDefaultScaleForNativeDataTypegetDefaultSchemagetDefaultSchemaNamegetFetchSizegetJdbcCatalogNamegetJdbcCatalogNamegetJdbcSchemaNamegetJdbcSchemaNamegetLineCommentgetLiquibaseCatalogNamegetLiquibaseSchemaNamegetLiquibaseTablespaceNamegetNamegetObjectQuotingStrategygetOutputDefaultCataloggetOutputDefaultSchemagetQuotingEndCharactergetQuotingEndReplacementgetQuotingStartCharactergetRanChangeSetgetRanChangeSetListgetRanDategetRawDatabaseChangeLogLockTableNamegetRawDatabaseChangeLogTableNamegetRunStatusgetSchemaAndCatalogCasegetSchemaFromJdbcInfogetSystemSchemagetSystemTablesgetSystemViewsgetTimeLiteralhashCodeisAutoCommitisCaseSensitiveisCatalogOrSchemaTypeisCurrentTimeFunctionisDateOnlyisDateTimeisDefaultCatalogisDefaultSchemaisFunctionisLiquibaseObjectisSystemObjectisSystemViewisTimeOnlyisTimestampjdbcCallsCatalogsSchemasmarkChangeSetExecStatusquoteObjectremoveRanStatusrequiresExplicitNullForColumnsrequiresPasswordrequiresUsernameresetInternalStaterollbacksaveRollbackStatementsaveStatementssetsetAutoCommitsetCanCacheLiquibaseTableInfosetCaseSensitivesetCurrentDateTimeFunctionsetDatabaseChangeLogLockTableNamesetDatabaseChangeLogTableNamesetDefaultCatalogNamesetDefaultSchemaNamesetLiquibaseCatalogNamesetLiquibaseSchemaNamesetLiquibaseTablespaceNamesetObjectQuotingStrategysetOutputDefaultCatalogsetOutputDefaultSchemastartsWithNumericsupportsAutoIncrementsupportsBatchUpdatessupportsCatalogInObjectNamesupportsCatalogssupportsDDLInTransactionsupportsForeignKeyDisablesupportsNotNullConstraintNamessupportsPrimaryKeyNamessupportsRestrictForeignKeyssupportsSchemastagtoStringunescapeDataTypeNameunescapeDataTypeStringvalidate

Field Detail

BUILD_VERSION_FOR_MINMAX_IN_SEQUENCESback to summary
private static final int BUILD_VERSION_FOR_MINMAX_IN_SEQUENCES
connectionSchemaNameback to summary
private String connectionSchemaName
END_CONCATback to summary
private static final String END_CONCAT
MAJOR_VERSION_FOR_MINMAX_IN_SEQUENCESback to summary
private static final int MAJOR_VERSION_FOR_MINMAX_IN_SEQUENCES
MINOR_VERSION_FOR_MINMAX_IN_SEQUENCESback to summary
private static final int MINOR_VERSION_FOR_MINMAX_IN_SEQUENCES
PATCH_VERSION_PATTERNback to summary
private static final Pattern PATCH_VERSION_PATTERN
PATCH_VERSION_REGEXback to summary
private static final String PATCH_VERSION_REGEX
SEP_CONCATback to summary
private static final String SEP_CONCAT
START_CONCATback to summary
private static final String START_CONCAT
V1_RESERVED_WORDSback to summary
protected static final Set<String> V1_RESERVED_WORDS
V2_RESERVED_WORDSback to summary
protected static final Set<String> V2_RESERVED_WORDS

Constructor Detail

H2Databaseback to summary
public H2Database()

Method Detail

correctObjectNameback to summary
public String correctObjectName(String objectName, Class<? extends DatabaseObject> objectType)

Overrides liquibase.database.AbstractJdbcDatabase.correctObjectName.

Implements liquibase.database.Database.correctObjectName.

Doc from liquibase.database.Database.correctObjectName.

Fix the object name to the format the database expects, handling changes in case, etc.

Annotations
@Override
createsIndexesForForeignKeysback to summary
public boolean createsIndexesForForeignKeys()

Overrides liquibase.database.AbstractJdbcDatabase.createsIndexesForForeignKeys.

Implements liquibase.database.Database.createsIndexesForForeignKeys.

Annotations
@Override
escapeObjectNameback to summary
public String escapeObjectName(String objectName, final Class<? extends DatabaseObject> objectType)

Overrides liquibase.database.AbstractJdbcDatabase.escapeObjectName.

Implements liquibase.database.Database.escapeObjectName.

Annotations
@Override
getAutoIncrementByClauseback to summary
protected String getAutoIncrementByClause()

Overrides liquibase.database.AbstractJdbcDatabase.getAutoIncrementByClause.

Annotations
@Override
getAutoIncrementClauseback to summary
protected String getAutoIncrementClause()

Overrides liquibase.database.AbstractJdbcDatabase.getAutoIncrementClause.

Annotations
@Override
getAutoIncrementClauseback to summary
public String getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull)

Overrides liquibase.database.AbstractJdbcDatabase.getAutoIncrementClause.

Implements liquibase.database.Database.getAutoIncrementClause.

Doc from liquibase.database.Database.getAutoIncrementClause.

Returns database-specific auto-increment DDL clause.

Annotations
@Override
getAutoIncrementStartWithClauseback to summary
protected String getAutoIncrementStartWithClause()

Overrides liquibase.database.AbstractJdbcDatabase.getAutoIncrementStartWithClause.

Annotations
@Override
getBuildVersionback to summary
private int getBuildVersion() throws DatabaseException
getConcatSqlback to summary
public String getConcatSql(String... values)

Overrides liquibase.database.AbstractJdbcDatabase.getConcatSql.

Implements liquibase.database.Database.getConcatSql.

Doc from liquibase.database.Database.getConcatSql.

Returns SQL to concat the passed values.

Annotations
@Override
getConcatSqlback to summary
private String getConcatSql(List<String> values)

Recursive way of building CONCAT instruction

Parameters
values:List<String>

a non null List of String

Returns:String

a String containing the CONCAT instruction with all elements, or only a value if there is only one element in the list

getConnectionSchemaNameback to summary
protected String getConnectionSchemaName()

Overrides liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName.

Doc from liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName.

Overwrite this method to get the default schema name for the connection. If you only need to change the statement that obtains the current schema then override

Annotations
@Override
getDateLiteralback to summary
public String getDateLiteral(String isoDate)

Overrides liquibase.database.AbstractJdbcDatabase.getDateLiteral.

Implements liquibase.database.Database.getDateLiteral.

Doc from liquibase.database.AbstractJdbcDatabase.getDateLiteral.

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

Annotations
@Override
getDefaultDatabaseProductNameback to summary
protected String getDefaultDatabaseProductName()

Implements abstract liquibase.database.AbstractJdbcDatabase.getDefaultDatabaseProductName.

Annotations
@Override
getDefaultDriverback to summary
public String getDefaultDriver(String url)

Implements liquibase.database.Database.getDefaultDriver.

Doc from liquibase.database.Database.getDefaultDriver.

If this database understands the given url, return the default driver class name. Otherwise return null.

Annotations
@Override
getDefaultPortback to summary
public Integer getDefaultPort()

Implements liquibase.database.Database.getDefaultPort.

Annotations
@Override
getMaxFractionalDigitsForTimestampback to summary
public int getMaxFractionalDigitsForTimestamp()

Overrides liquibase.database.AbstractJdbcDatabase.getMaxFractionalDigitsForTimestamp.

Implements liquibase.database.Database.getMaxFractionalDigitsForTimestamp.

Doc from liquibase.database.AbstractJdbcDatabase.getMaxFractionalDigitsForTimestamp.

Most relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.

Returns:int

the maximum number of supported fractional digits in TIMESTAMP columns

Annotations
@Override
getPriorityback to summary
public int getPriority()

Implements liquibase.servicelocator.PrioritizedService.getPriority.

Annotations
@Override
getReservedWordsback to summary
protected Set<String> getReservedWords()
getShortNameback to summary
public String getShortName()

Implements liquibase.database.Database.getShortName.

Doc from liquibase.database.Database.getShortName.

Returns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition.

Annotations
@Override
getViewDefinitionback to summary
public String getViewDefinition(CatalogAndSchema schema, String name) throws DatabaseException

Overrides liquibase.database.AbstractJdbcDatabase.getViewDefinition.

Implements liquibase.database.Database.getViewDefinition.

Annotations
@Override
isCorrectDatabaseImplementationback to summary
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException

Implements liquibase.database.Database.isCorrectDatabaseImplementation.

Doc from liquibase.database.Database.isCorrectDatabaseImplementation.

Is this AbstractDatabase subclass the correct one to use for the given connection.

Annotations
@Override
isIllegalIdentifierback to summary
private boolean isIllegalIdentifier(String objectName)
isReservedWordback to summary
public boolean isReservedWord(String objectName)

Overrides liquibase.database.AbstractJdbcDatabase.isReservedWord.

Implements liquibase.database.Database.isReservedWord.

Annotations
@Override
isSafeToRunUpdateback to summary
public boolean isSafeToRunUpdate() throws DatabaseException

Overrides liquibase.database.AbstractJdbcDatabase.isSafeToRunUpdate.

Implements liquibase.database.Database.isSafeToRunUpdate.

Doc from liquibase.database.AbstractJdbcDatabase.isSafeToRunUpdate.

Default implementation of the isSafeToRunUpdate() method. It checks if the database connection URL contains "localhost" or "127.0.0.1". If the database returns a null URL, the method returns false because it's not known whether it's safe to run the update.

Returns:boolean

true if the database connection URL contains "localhost" or "127.0.0.1", otherwise false.

Annotations
@Override
Exceptions
DatabaseException:
if there is an error accessing the database
mustQuoteObjectNameback to summary
protected boolean mustQuoteObjectName(String objectName, Class<? extends DatabaseObject> objectType)

Overrides liquibase.database.AbstractJdbcDatabase.mustQuoteObjectName.

Annotations
@Override
parseDateback to summary
public Date parseDate(String dateAsString) throws DateParseException

Overrides liquibase.database.AbstractJdbcDatabase.parseDate.

Implements liquibase.database.Database.parseDate.

Annotations
@Override
setConnectionback to summary
public void setConnection(DatabaseConnection conn)

Overrides liquibase.database.AbstractJdbcDatabase.setConnection.

Implements liquibase.database.Database.setConnection.

Annotations
@Override
supportsCreateIfNotExistsback to summary
public boolean supportsCreateIfNotExists(Class<? extends DatabaseObject> type)

Overrides default liquibase.database.Database.supportsCreateIfNotExists.

Doc from liquibase.database.Database.supportsCreateIfNotExists.

Does the database support the "if not exits" syntax?

Parameters
type:Class<? extends DatabaseObject>

the DatabaseObject type to be checked.

Returns:boolean

true if the "if not exists" syntax is supported, false otherwise.

Annotations
@Override
supportsDropTableCascadeConstraintsback to summary
public boolean supportsDropTableCascadeConstraints()

Overrides liquibase.database.AbstractJdbcDatabase.supportsDropTableCascadeConstraints.

Implements liquibase.database.Database.supportsDropTableCascadeConstraints.

Annotations
@Override
supportsInitiallyDeferrableColumnsback to summary
public boolean supportsInitiallyDeferrableColumns()

Implements liquibase.database.Database.supportsInitiallyDeferrableColumns.

Doc from liquibase.database.Database.supportsInitiallyDeferrableColumns.

Returns whether this database support initially deferrable columns.

Annotations
@Override
supportsMinMaxForSequencesback to summary
public boolean supportsMinMaxForSequences()
supportsSequencesback to summary
public boolean supportsSequences()

Overrides liquibase.database.AbstractJdbcDatabase.supportsSequences.

Implements liquibase.database.Database.supportsSequences.

Doc from liquibase.database.AbstractJdbcDatabase.supportsSequences.

Does the database type support sequence.

Annotations
@Override
supportsTablespacesback to summary
public boolean supportsTablespaces()

Implements liquibase.database.Database.supportsTablespaces.

Annotations
@Override