public interface DbmsHelper
Modifier and Type | Method and Description |
---|---|
String |
getAddColumnStatement(String tableName,
DBAccessor.DBColumnInfo columnInfo) |
String |
getAddForeignKeyStatement(String tableName,
String constraintName,
List<String> keyColumns,
String referenceTableName,
List<String> referenceColumns,
boolean shouldCascadeOnDelete) |
String |
getAddPrimaryKeyConstraintStatement(String tableName,
String constraintName,
String... columnName)
Generate alter table statement to add primary key index
|
String |
getAddUniqueConstraintStatement(String tableName,
String constraintName,
String... columnNames)
Generate alter table statement to add unique constraint
|
String |
getAlterColumnStatement(String tableName,
DBAccessor.DBColumnInfo columnInfo)
Generate alter column statement
|
String |
getColumnUpdateStatementWhereColumnIsNull(String tableName,
String setColumnName,
String conditionColumnName)
Generating update SQL statement for
DBAccessor.executePreparedUpdate(java.lang.String, java.lang.Object...) |
String |
getCopyColumnToAnotherTableStatement(String sourceTable,
String sourceColumnName,
String sourceIDColumnName,
String targetTable,
String targetColumnName,
String targetIDColumnName)
Get's the
UPDATE statement for sourceTable for copy column from targetTable by matching
table keys sourceIDColumnName and targetIDColumnName |
String |
getCopyColumnToAnotherTableStatement(String sourceTable,
String sourceColumnName,
String sourceIDColumnName1,
String sourceIDColumnName2,
String sourceIDColumnName3,
String targetTable,
String targetColumnName,
String targetIDColumnName1,
String targetIDColumnName2,
String targetIDColumnName3,
String sourceConditionFieldName,
String condition)
Get's the
UPDATE statement for sourceTable for copy column from targetTable by matching
table keys sourceIDColumnName and targetIDColumnName
and condition sourceConditionFieldName = condition |
String |
getCreateIndexStatement(String indexName,
String tableName,
boolean isUnique,
String... columnNames) |
String |
getCreateIndexStatement(String indexName,
String tableName,
String... columnNames) |
String |
getCreateTableStatement(String tableName,
List<DBAccessor.DBColumnInfo> columns,
List<String> primaryKeyColumns) |
String |
getDropFKConstraintStatement(String tableName,
String constraintName) |
String |
getDropIndexStatement(String indexName,
String tableName)
Gets DROP INDEX statement
|
String |
getDropPrimaryKeyStatement(String tableName,
String constraintName,
boolean cascade) |
String |
getDropSequenceStatement(String sequenceName) |
String |
getDropTableColumnStatement(String tableName,
String columnName) |
String |
getDropTableStatement(String tableName) |
String |
getDropUniqueConstraintStatement(String tableName,
String constraintName) |
String |
getRenameColumnStatement(String tableName,
String oldName,
DBAccessor.DBColumnInfo columnInfo)
Generate rename column statement
|
String |
getRenameColumnStatement(String tableName,
String oldColumnName,
String newColumnName) |
String |
getSetNullableStatement(String tableName,
DBAccessor.DBColumnInfo columnInfo,
boolean nullable)
Gets the
SET NULL or SET NOT NULL statement. |
String |
getTableConstraintsStatement(String databaseName,
String tablename) |
boolean |
isConstraintSupportedAfterNullability()
Gets whether the database platform supports adding contraints after the
NULL constraint. |
String |
quoteObjectName(String name) |
boolean |
supportsColumnTypeChange()
Check if column type can be modified directly
|
boolean supportsColumnTypeChange()
String getRenameColumnStatement(String tableName, String oldName, DBAccessor.DBColumnInfo columnInfo)
tableName
- oldName
- columnInfo
- definition of new columnString getAlterColumnStatement(String tableName, DBAccessor.DBColumnInfo columnInfo)
tableName
- columnInfo
- String getCreateTableStatement(String tableName, List<DBAccessor.DBColumnInfo> columns, List<String> primaryKeyColumns)
String getTableConstraintsStatement(String databaseName, String tablename)
String getCreateIndexStatement(String indexName, String tableName, String... columnNames)
String getCreateIndexStatement(String indexName, String tableName, boolean isUnique, String... columnNames)
String getColumnUpdateStatementWhereColumnIsNull(String tableName, String setColumnName, String conditionColumnName)
DBAccessor.executePreparedUpdate(java.lang.String, java.lang.Object...)
tableName
- name of the tablesetColumnName
- column name, value of which need to be setconditionColumnName
- column name for the conditionString getDropIndexStatement(String indexName, String tableName)
indexName
- tableName
- String getAddUniqueConstraintStatement(String tableName, String constraintName, String... columnNames)
tableName
- name of the tableconstraintName
- name of the constraintcolumnNames
- name of the columnString getAddPrimaryKeyConstraintStatement(String tableName, String constraintName, String... columnName)
tableName
- name of the tableconstraintName
- name of the primary keycolumnName
- name of the columnString getAddForeignKeyStatement(String tableName, String constraintName, List<String> keyColumns, String referenceTableName, List<String> referenceColumns, boolean shouldCascadeOnDelete)
String getAddColumnStatement(String tableName, DBAccessor.DBColumnInfo columnInfo)
String getRenameColumnStatement(String tableName, String oldColumnName, String newColumnName)
String getDropFKConstraintStatement(String tableName, String constraintName)
String getDropUniqueConstraintStatement(String tableName, String constraintName)
String getDropPrimaryKeyStatement(String tableName, String constraintName, boolean cascade)
String getSetNullableStatement(String tableName, DBAccessor.DBColumnInfo columnInfo, boolean nullable)
SET NULL
or SET NOT NULL
statement.tableName
- the table (not null
).columnInfo
- the column object to get name and type of column (not null
).nullable
- true
to indicate that the column allows NULL
values, false
otherwise.null
).String getCopyColumnToAnotherTableStatement(String sourceTable, String sourceColumnName, String sourceIDColumnName, String targetTable, String targetColumnName, String targetIDColumnName)
UPDATE
statement for sourceTable
for copy column from targetTable
by matching
table keys sourceIDColumnName
and targetIDColumnName
sourceTable
- the source table namesourceColumnName
- the source column namesourceIDColumnName
- source key id column which would be used to math right rows for targetTable
targetTable
- the destination table nametargetColumnName
- the destination column nametargetIDColumnName
- destination key id column name which should math sourceIDColumnName
String getCopyColumnToAnotherTableStatement(String sourceTable, String sourceColumnName, String sourceIDColumnName1, String sourceIDColumnName2, String sourceIDColumnName3, String targetTable, String targetColumnName, String targetIDColumnName1, String targetIDColumnName2, String targetIDColumnName3, String sourceConditionFieldName, String condition)
UPDATE
statement for sourceTable
for copy column from targetTable
by matching
table keys sourceIDColumnName
and targetIDColumnName
and condition sourceConditionFieldName
= condition
sourceTable
- the source table namesourceColumnName
- the source column namesourceIDColumnName1
- source key id column which would be used to math right rows for targetTable
sourceIDColumnName2
- source key id column which would be used to math right rows for targetTable
sourceIDColumnName3
- source key id column which would be used to math right rows for targetTable
targetTable
- the destination table nametargetColumnName
- the destination column nametargetIDColumnName1
- destination key id column name which should match sourceIDColumnName1
targetIDColumnName2
- destination key id column name which should match sourceIDColumnName1
targetIDColumnName3
- destination key id column name which should match sourceIDColumnName1
sourceConditionFieldName
- source key column name which should match condition
condition
- value which should match sourceConditionFieldName
boolean isConstraintSupportedAfterNullability()
NULL
constraint. Some database, such as Oracle, don't allow this.
Unfortunately, EclipsLink hard codes the order of constraints.true
if contraints can be added after the NULL
constraint, false
otherwise.Copyright © 2022 Apache Software Foundation. All rights reserved.