public class H2DbmsBean extends AbstractDbmsBean
DbmsBean.ColumnDefinition, DbmsBean.ConstraintDefinition, DbmsBean.IndexDefinition
LARGE_STRING_TYPE
Constructor and Description |
---|
H2DbmsBean() |
Modifier and Type | Method and Description |
---|---|
void |
dropIndex(Connection c,
String table,
String index) |
void |
dropPrimaryKey(Connection connection,
String tableName)
Drops the primary key on a table.
|
String |
getConcat(String... values)
Provide a different SQL concatenation operator depending on SQL engine used.
|
protected List<DbmsBean.ConstraintDefinition> |
getConstraintDefinitions(Connection connection,
String query,
String column)
Finds all constraints affecting given column.
|
Collection<DbmsBean.ConstraintDefinition> |
getConstraints(Connection connection,
String table,
String column)
Fetch information about constraints
|
protected DbmsBean.ConstraintDefinition.ConstraintType |
getConstraintType(String typeName) |
DatabaseType |
getDatabaseType()
Detect used database type
|
Collection<DbmsBean.IndexDefinition> |
getIndices(Connection c,
String table) |
String |
getQuery(SqlQueryProvider sqlQueryProvider)
Provide a different SQL query depending on SQL engine used.
|
protected void |
handleException(Connection connection,
String table,
org.h2.jdbc.JdbcSQLException e,
BambooRunnables.Throwing<SQLException> command)
Attempts to handle an SQL exception, performing
command after properly fixing the state of the database
if the cause of the problem is known. |
boolean |
isH2() |
void |
renameColumn(Connection c,
String tableName,
String oldName,
String newName)
Rename columns.
|
void |
resizeVarcharColumn(Connection connection,
String tableName,
String columnName,
int newSize,
boolean isNullable,
String defaultValue) |
actuallyChangeColumnToNotNull, addColumn, changeColumnDefinition, changeColumnToNotNull, changeColumnType, changeTableNameToUpperCase, clobEquals, createColumn, createIndex, createPrimaryKey, createUniqueConstraint, dropColumn, dropConstraint, dropConstraints, dropForeignKeyConstraint, dropIndexIfExists, dropTable, getColumnDefinition, getColumns, getConstraintDefinitions, getIndexNames, getLargeTextTypeName, getSchema, getSchemaUncached, getSqlTypeName, getTables, isColumnPresent, isColumnPresent, isColumnPresent, isHsqldb, isMsSqlServer, isMySql, isOracle, isPostgreSql, isTable, isTablePresent, migrateColumnType, newColumnDefinition, quote, quoteIfNeeded, toLowerCase
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCatalog
@NotNull public String getQuery(@NotNull SqlQueryProvider sqlQueryProvider)
DbmsBean
@NotNull public String getConcat(String... values)
DbmsBean
values
- the values to concatenate.@NotNull public Collection<DbmsBean.ConstraintDefinition> getConstraints(Connection connection, String table, @Nullable String column) throws SQLException
DbmsBean
SQLException
protected List<DbmsBean.ConstraintDefinition> getConstraintDefinitions(Connection connection, String query, @Nullable String column) throws SQLException
SQLException
protected DbmsBean.ConstraintDefinition.ConstraintType getConstraintType(String typeName)
getConstraintType
in class AbstractDbmsBean
public void resizeVarcharColumn(@NotNull Connection connection, String tableName, String columnName, int newSize, boolean isNullable, @Nullable String defaultValue) throws SQLException
SQLException
public DatabaseType getDatabaseType()
DbmsBean
public boolean isH2()
isH2
in interface DbmsBean
isH2
in class AbstractDbmsBean
public void dropPrimaryKey(Connection connection, String tableName) throws SQLException
DbmsBean
SQLException
public void renameColumn(Connection c, String tableName, String oldName, String newName) throws SQLException
DbmsBean
renameColumn
in interface DbmsBean
renameColumn
in class AbstractDbmsBean
SQLException
public void dropIndex(Connection c, String table, String index) throws SQLException
dropIndex
in interface DbmsBean
dropIndex
in class AbstractDbmsBean
SQLException
protected void handleException(@NotNull Connection connection, @NotNull String table, @NotNull org.h2.jdbc.JdbcSQLException e, @NotNull BambooRunnables.Throwing<SQLException> command) throws SQLException
command
after properly fixing the state of the database
if the cause of the problem is known. Re-throws the exception if the cause is unknown.connection
- database connectiontable
- table to which the problem is relatede
- exception throwncommand
- command to execute after properly addressing the issueSQLException
- if thrown by command
, or if exception could not be handled and e
is rethrownpublic Collection<DbmsBean.IndexDefinition> getIndices(@NotNull Connection c, @NotNull String table) throws SQLException
getIndices
in interface DbmsBean
getIndices
in class AbstractDbmsBean
SQLException
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.