public class PostgreSqlDbmsBean extends AbstractDbmsBean
DbmsBean.ColumnDefinition, DbmsBean.ConstraintDefinition, DbmsBean.IndexDefinition
LARGE_STRING_TYPE
Constructor and Description |
---|
PostgreSqlDbmsBean() |
Modifier and Type | Method and Description |
---|---|
protected void |
changeColumnDefinition(Connection c,
String table,
String column,
String sqlType,
boolean isNullable) |
void |
dropIndex(Connection c,
String table,
String index) |
void |
dropPrimaryKey(Connection c,
String tableName)
Drops the primary key on a table.
|
List<DbmsBean.ColumnDefinition> |
getColumns(Connection c,
String table,
String column) |
String |
getConcat(String... values)
Provide a different SQL concatenation operator depending on SQL engine used.
|
Collection<DbmsBean.ConstraintDefinition> |
getConstraints(Connection connection,
String table,
String column)
Fetch information about constraints
|
DatabaseType |
getDatabaseType()
Detect used database type
|
Set<String> |
getIndexNames(Connection c,
String table,
String column)
Returns indices set up on a given table, optionally narrowed down to a column.
|
Collection<DbmsBean.IndexDefinition> |
getIndices(Connection c,
String table) |
String |
getQuery(SqlQueryProvider sqlQueryProvider)
Provide a different SQL query depending on SQL engine used.
|
boolean |
isPostgreSql() |
boolean |
isTablePresent(Connection c,
String tableName)
Checks whether given table is present in the database
|
protected String |
quote(String name)
Some tables in db can be stored in a case sensitive manner.
|
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, changeColumnToNotNull, changeColumnType, changeTableNameToUpperCase, createColumn, createIndex, createPrimaryKey, createUniqueConstraint, dropColumn, dropConstraint, dropConstraints, dropForeignKeyConstraint, dropIndexIfExists, dropTable, getColumnDefinition, getConstraintDefinitions, getConstraintType, getSchema, getSchemaUncached, getTables, isColumnPresent, isColumnPresent, isColumnPresent, isH2, isHsqldb, isMsSqlServer, isMySql, isOracle, migrateColumnType, newColumnDefinition
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, @NotNull String table, @Nullable String column) throws SQLException
DbmsBean
SQLException
public void resizeVarcharColumn(@NotNull Connection connection, String tableName, String columnName, int newSize, boolean isNullable, @Nullable String defaultValue) throws SQLException
SQLException
public boolean isPostgreSql()
isPostgreSql
in interface DbmsBean
isPostgreSql
in class AbstractDbmsBean
public DatabaseType getDatabaseType()
DbmsBean
public void dropPrimaryKey(Connection c, String tableName) throws SQLException
DbmsBean
SQLException
protected void changeColumnDefinition(Connection c, String table, String column, String sqlType, boolean isNullable) throws SQLException
changeColumnDefinition
in class AbstractDbmsBean
SQLException
public void dropIndex(Connection c, String table, String index) throws SQLException
dropIndex
in interface DbmsBean
dropIndex
in class AbstractDbmsBean
SQLException
public void renameColumn(Connection c, String tableName, String oldName, String newName) throws SQLException
DbmsBean
renameColumn
in interface DbmsBean
renameColumn
in class AbstractDbmsBean
SQLException
protected String quote(String name)
AbstractDbmsBean
quote
in class AbstractDbmsBean
public Set<String> getIndexNames(@NotNull Connection c, @NotNull String table, @Nullable String column) throws SQLException
DbmsBean
getIndexNames
in interface DbmsBean
getIndexNames
in class AbstractDbmsBean
SQLException
public Collection<DbmsBean.IndexDefinition> getIndices(@NotNull Connection c, @NotNull String table) throws SQLException
getIndices
in interface DbmsBean
getIndices
in class AbstractDbmsBean
SQLException
public boolean isTablePresent(@NotNull Connection c, @NotNull String tableName) throws SQLException
DbmsBean
isTablePresent
in interface DbmsBean
isTablePresent
in class AbstractDbmsBean
c
- connection used to verify DB table existencetableName
- name of DB tableSQLException
- if a database error occurs or connection is closedpublic List<DbmsBean.ColumnDefinition> getColumns(Connection c, @NotNull String table, @Nullable String column) throws SQLException
getColumns
in interface DbmsBean
getColumns
in class AbstractDbmsBean
SQLException
Copyright © 2018 Atlassian Software Systems Pty Ltd. All rights reserved.