@Internal public interface DbmsBean extends BambooDatabaseTypeProvider
Modifier and Type | Interface and Description |
---|---|
static class |
DbmsBean.ColumnDefinition |
static class |
DbmsBean.ConstraintDefinition |
static class |
DbmsBean.IndexDefinition |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Connection c,
String tableName,
String columnName,
int columnType,
@Nullable Integer columnSize)
Add a column to a table.
|
void |
changeColumnToNotNull(Connection c,
String tableName,
String columnName)
Changes column to not null, unless it's already not null.
|
void |
changeColumnType(Connection c,
String table,
String column,
int type,
@Nullable Integer columnSize,
boolean isNullable)
Changes column type to the new type (see
Types . |
void |
changeTableNameToUpperCase(Connection connection,
String oldName)
Rename table from lower case to upper case.
|
@NotNull String |
clobEquals(@NotNull String columnName)
Comparison string for CLOB column.
|
void |
createColumn(@NotNull Connection connection,
@NotNull String tableName,
@NotNull String columnName,
int columnType) |
void |
createIndex(Connection c,
String index,
String table,
String column) |
void |
createUniqueConstraint(Connection c,
String uniqueKey,
String table,
String... columns)
Create unique key
|
boolean |
dropColumn(@NotNull Connection connection,
@NotNull String tableName,
@NotNull String columnName)
Checks whether given table contains the specified column and drops it
Checks whether given table contains the specified column and drops it, as well as foreign key constraints and index on the column.
|
void |
dropConstraint(Connection c,
String tableName,
String constraint)
Drop constraint
|
void |
dropForeignKeyConstraint(Connection c,
String tableName,
String foreignKey) |
void |
dropIndex(Connection c,
String table,
String index) |
boolean |
dropIndexIfExists(Connection c,
String table,
@NotNull String indexName)
Tries to find index by name ignoring case and removes it if found.
|
void |
dropPrimaryKey(Connection connection,
String tableName)
Drops the primary key on a table.
|
void |
dropTable(Connection c,
String tableName)
Drop table.
|
default @Nullable String |
getCatalog(Connection c) |
List<DbmsBean.ColumnDefinition> |
getColumns(Connection c,
@NotNull String table,
@Nullable String column) |
@NotNull String |
getConcat(String... values)
Provide a different SQL concatenation operator depending on SQL engine used.
|
@NotNull Collection<DbmsBean.ConstraintDefinition> |
getConstraints(Connection connection,
@NotNull String table,
@Nullable String column)
Fetch information about constraints
|
Set<String> |
getIndexNames(@NotNull Connection c,
@NotNull String table,
@Nullable String column)
Returns indices set up on a given table, optionally narrowed down to a column.
|
Collection<DbmsBean.IndexDefinition> |
getIndices(@NotNull Connection c,
@NotNull String table) |
@NotNull String |
getLargeTextTypeName() |
@NotNull String |
getQuery(@NotNull SqlQueryProvider sqlQueryProvider)
Provide a different SQL query depending on SQL engine used.
|
@Nullable String |
getSchema(Connection c)
Schema name, retrieved from connection or cache
|
List<String> |
getTables(@NotNull Connection c)
Retrieves the list of table names in the current schema.
|
boolean |
isColumnPresent(@NotNull Connection connection,
@NotNull String tableName,
@NotNull String columnName)
Checks whether given table contains the specified column.
|
boolean |
isColumnPresent(@NotNull Statement statement,
@NotNull String tableName,
@NotNull String columnName)
Checks whether given table contains the specified column.
|
boolean |
isH2() |
boolean |
isHsqldb()
Deprecated.
since 6.3 HSQL is no longer supported, method will always return false
|
boolean |
isMsSqlServer() |
boolean |
isMySql() |
boolean |
isOracle() |
boolean |
isPostgreSql() |
boolean |
isTablePresent(@NotNull Connection connection,
@NotNull String tableName)
Checks whether given table is present in the database
|
void |
migrateColumnType(Connection c,
String table,
String column,
int columnType,
@Nullable Integer columnSize)
Changes column type to the new type (see
Types . |
String |
quote(String name)
Quotes the supplied name according to the quoting rules of the underlying DBMS.
|
void |
renameColumn(Connection c,
String tableName,
String oldName,
String newName)
Rename columns.
|
void |
resizeVarcharColumn(@NotNull Connection connection,
String tableName,
String columnName,
int newSize,
boolean isNullable,
@Nullable String defaultValue) |
String |
toLowerCase(String columnName) |
getDatabaseType
@NotNull @NotNull String getQuery(@NotNull @NotNull SqlQueryProvider sqlQueryProvider)
sqlQueryProvider
- @NotNull @NotNull String getConcat(String... values)
values
- the values to concatenate.@NotNull @NotNull Collection<DbmsBean.ConstraintDefinition> getConstraints(Connection connection, @NotNull @NotNull String table, @Nullable @Nullable String column) throws SQLException
SQLException
Set<String> getIndexNames(@NotNull @NotNull Connection c, @NotNull @NotNull String table, @Nullable @Nullable String column) throws SQLException
SQLException
boolean isColumnPresent(@NotNull @NotNull Connection connection, @NotNull @NotNull String tableName, @NotNull @NotNull String columnName) throws SQLException
SQLException
boolean isColumnPresent(@NotNull @NotNull Statement statement, @NotNull @NotNull String tableName, @NotNull @NotNull String columnName) throws SQLException
SQLException
boolean dropColumn(@NotNull @NotNull Connection connection, @NotNull @NotNull String tableName, @NotNull @NotNull String columnName) throws SQLException
connection
- tableName
- columnName
- SQLException
void migrateColumnType(Connection c, String table, String column, int columnType, @Nullable @Nullable Integer columnSize) throws SQLException
Types
. Uses rename + add + copy + drop for maximum compatibility.SQLException
void changeColumnType(Connection c, String table, String column, int type, @Nullable @Nullable Integer columnSize, boolean isNullable) throws SQLException
Types
. Uses alter table, so won't cope with all type conversions.SQLException
void createColumn(@NotNull @NotNull Connection connection, @NotNull @NotNull String tableName, @NotNull @NotNull String columnName, int columnType) throws SQLException
SQLException
void dropIndex(Connection c, String table, String index) throws SQLException
SQLException
boolean dropIndexIfExists(Connection c, String table, @NotNull @NotNull String indexName) throws SQLException
indexName
- SQLException
void createIndex(Connection c, String index, String table, String column) throws SQLException
SQLException
void createUniqueConstraint(Connection c, String uniqueKey, String table, String... columns) throws SQLException
SQLException
- if the operation fails (ie. key exists or data in the column is not unique)boolean isTablePresent(@NotNull @NotNull Connection connection, @NotNull @NotNull String tableName) throws SQLException
connection
- connection used to verify DB table existencetableName
- name of DB tableSQLException
- if a database error occurs or connection is closedvoid resizeVarcharColumn(@NotNull @NotNull Connection connection, String tableName, String columnName, int newSize, boolean isNullable, @Nullable @Nullable String defaultValue) throws SQLException
SQLException
boolean isMySql()
boolean isOracle()
@Nullable @Nullable String getSchema(Connection c) throws SQLException
SQLException
@Nullable default @Nullable String getCatalog(Connection c) throws SQLException
SQLException
@Deprecated boolean isHsqldb()
boolean isH2()
boolean isPostgreSql()
boolean isMsSqlServer()
void dropPrimaryKey(Connection connection, String tableName) throws SQLException
SQLException
void changeTableNameToUpperCase(Connection connection, String oldName) throws SQLException
SQLException
void renameColumn(Connection c, String tableName, String oldName, String newName) throws SQLException
SQLException
void addColumn(Connection c, String tableName, String columnName, int columnType, @Nullable @Nullable Integer columnSize) throws SQLException
SQLException
void dropConstraint(Connection c, String tableName, String constraint) throws SQLException
SQLException
- if constraint does not existvoid dropForeignKeyConstraint(Connection c, String tableName, String foreignKey) throws SQLException
SQLException
void changeColumnToNotNull(Connection c, String tableName, String columnName) throws SQLException
SQLException
Collection<DbmsBean.IndexDefinition> getIndices(@NotNull @NotNull Connection c, @NotNull @NotNull String table) throws SQLException
SQLException
List<DbmsBean.ColumnDefinition> getColumns(Connection c, @NotNull @NotNull String table, @Nullable @Nullable String column) throws SQLException
SQLException
void dropTable(Connection c, String tableName) throws SQLException
SQLException
List<String> getTables(@NotNull @NotNull Connection c) throws SQLException
SQLException
String quote(String name)
@NotNull @NotNull String clobEquals(@NotNull @NotNull String columnName)
columnName
- column name@NotNull @NotNull String getLargeTextTypeName()
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.