public interface Backend
| Modifier and Type | Field and Description |
|---|---|
static String |
SQL_ALLSTAR
'*' all string.
|
static String |
SQL_ALTER_COLUMN
SQL ALTER COLUMN fragment.
|
static String |
SQL_ALTER_INDEX
SQL ALTER INDEX intro.
|
static String |
SQL_ALTER_TABLE
SQL ALTER TABLE intro.
|
static String |
SQL_AND
AND string.
|
static String |
SQL_ANDNOT
AND NOT string.
|
static String |
SQL_COMMA
comma separator.
|
static String |
SQL_COMMA_PAR
Parameter ,? string.
|
static String |
SQL_DELETE
DELETE string.
|
static String |
SQL_EQUAL
= operator string.
|
static String |
SQL_EQUAL_PAR
Parameter =? string.
|
static String |
SQL_EQUAL_PAR_COMMA
Parameter =?, string.
|
static String |
SQL_EQUAL_ZERO
=0 string.
|
static String |
SQL_EXISTS
SQL EXISTS clause with SELECT 1 and opening left parenthesis.
|
static String |
SQL_FROM
FROM string.
|
static String |
SQL_GREATER
> operator string.
|
static String |
SQL_GREATER_PAR
Parameter >? string.
|
static String |
SQL_GREATEROREQUAL
>= operator string.
|
static String |
SQL_GREATEROREQUAL_PAR
Parameter ≥? string.
|
static String |
SQL_GROUPBY
GROUP BY string.
|
static String |
SQL_IF_EXISTS
SQL IF EXISTS fragment.
|
static String |
SQL_INSERT_INTO
INSERT INTO string.
|
static String |
SQL_INSERT_VALUES
(VALUES) string for insert.
|
static String |
SQL_ISNOTNULL
IS NOT NULL string.
|
static String |
SQL_ISNULL
IS NULL string.
|
static String |
SQL_LEFT_PARENTHESIS
opening bracket.
|
static String |
SQL_LESS
< operator string.
|
static String |
SQL_LESS_PAR
Parameter <? string.
|
static String |
SQL_LESSOREQUAL
<= operator string.
|
static String |
SQL_LESSOREQUAL_PAR
Parameter <=? string.
|
static String |
SQL_LIKE
LIKE operator string.
|
static String |
SQL_LIKE_PAR
Parameter LIKE ? string.
|
static String |
SQL_MAX
MAX function name.
|
static String |
SQL_MIN
MAX function name.
|
static String |
SQL_NOT
NOT string.
|
static String |
SQL_NOTEQUAL
<> operator string.
|
static String |
SQL_NOTEQUAL_PAR
Parameter <>? string.
|
static String |
SQL_NOTEQUAL_ZERO
<>0 string.
|
static String |
SQL_NOTLIKE
NOT LIKE operator string.
|
static String |
SQL_NOTLIKE_PAR
Parameter NOT LIKE ? string.
|
static String |
SQL_OR
OR string.
|
static String |
SQL_ORDERBY
ORDER BY string.
|
static String |
SQL_ORNOT
OR NOT string.
|
static String |
SQL_PAR
? string.
|
static String |
SQL_PAR_COMMA
Parameter ?, string.
|
static String |
SQL_PLUS_ONE
+1 string.
|
static String |
SQL_RIGHT_PARENTHESIS
closing bracket.
|
static String |
SQL_SELECT
SELECT string.
|
static String |
SQL_SELECT_ALL_FROM
SELECT * FROM string.
|
static String |
SQL_SET
SET string.
|
static String |
SQL_SORTASC
sort ASC string.
|
static String |
SQL_SORTDESC
sort DESC string.
|
static String |
SQL_UPDATE
UPDATE string.
|
static String |
SQL_WHERE
WHERE string.
|
static String |
SQL_WHEREALL
"WHERE 1=1" allows AND to be added.
|
static String |
SQL_WHEREAND
SQL_WHEREALL + AND will be replaced by...
|
static String |
SQL_WHERENOTHING
"WHERE 1=0" to select nothing.
|
static String |
SQL_WHEREOR
SQL_WHEREALL + OR will be replaced by...
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsExpressionsReferringToTablesBeingUpdated()
Determines whether backend allows expressions referring to tables being updated.
|
void |
assertValidName(SqlNameType nameType,
String name)
Asserts that given string is a valid name and usage.
|
String |
buildSelectSql(String sql,
boolean writeLock,
int limit,
int offset)
Creates a select statement string from an inner sql string.
|
void |
buildSelectSql(StringBuilder sqlBuilder,
boolean writeLock,
int limit,
int offset)
Creates a select statement string from an inner sql string.
|
String |
columnTypeNullDefaultToString(String columnName,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue)
Converts an sqltype, size, scale, nullable and default value to a database type declaration.
|
String |
columnTypeToString(SqlType sqlType,
int size,
int scale)
Converts an sqltype, size and scale to a database type declaration.
|
ColumnMetaData |
createColumnMetaData(TableMetaData tableMetaData)
Creates a column meta data instance.
|
Connection |
createConnection(String url,
String username,
char[] password)
Creates a jdbc connection.
|
IndexColumnMetaData |
createIndexColumnMetaData(IndexMetaData indexMetaData)
Creates an index column meta data instance.
|
IndexMetaData |
createIndexMetaData(TableMetaData tableMetaData)
Creates an index meta data instance.
|
TableMetaData |
createTableMetaData(ModelMetaData metaData,
String tableName)
Creates a meta data instance.
|
String |
getBackendId(Connection connection)
Determines the unique id or name used by the backend for a given connection.
|
String |
getCoalesceKeyword()
Gets the keyword for the COALESCE function.
|
String |
getDefaultSchema()
Gets the default schema name.
Some backends store the objects in a default schema, if no explicit schema is given. |
int |
getDefaultSize(SqlType sqlType)
Gets the default size if no size given in model.
|
String |
getDriverClassName()
Gets the JDBC driver class name.
|
String |
getEmptyString()
Gets the empty string.
|
int |
getMaxScale(SqlType sqlType,
int size)
Returns the maximum scale for a given SQL-type and size.
|
int |
getMaxSize(SqlType sqlType)
Returns the maximum size for a given SQL-type.
|
DatabaseMetaData[] |
getMetaData(BackendInfo backendInfo)
Gets the metadata from the backend.
|
MigrationStrategy[] |
getMigrationStrategy(ColumnMetaData column,
String columnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue)
Determines the best migration strategy.
|
ModelMetaData |
getModelMetaData(DatabaseMetaData[] metaData,
String[] schemas,
String... tableNames)
Retrieves the metadata.
|
String |
getName()
Gets the name of the backend.
|
Set<String> |
getReservedWords()
Gets the list of reserved words for this backend.
|
TableMetaData |
getTableMetaData(ModelMetaData modelMetaData,
String tableName)
Gets the table meta data for a given table name.
|
boolean |
isCommunicationLinkException(SQLException ex)
Determines whether exception is a communication error.
|
boolean |
isConstraintException(SQLException ex)
Determines whether exception is a constraint violation.
|
boolean |
isDefaultEqual(ColumnMetaData column,
SqlType sqlType,
Object defaultValue)
Checks whether the column's default corresponds to the model's default value.
|
boolean |
isDropIfExistsEnabled()
Returns whether backend should add IF EXISTS for generated DROPs.
|
boolean |
isMatchingName(String name)
Checks whether the backend belongs to the given name.
|
boolean |
isMatchingUrl(String url)
Checks whether the backend belongs to the given jdbc url.
|
boolean |
isReleaseSavepointSupported()
Returns whether the backend supports releasing savepoints explicitly.
|
boolean |
isTemporaryName(String name)
Checks whether this is a temporary name.
Returns whether an entity-, attribute- or index-name is temporary and should not be taken into account for migration or even used in the model. Depending on the backend, temporary names start with an underscore or some other lead string. |
SqlType[] |
jdbcTypeToSqlType(int jdbcType,
int size,
int scale)
Converts the JDBC data type integer to a tentackle backend SqlTypes.
|
boolean |
needAliasForSubselect()
Returns whether backend needs an alias for a subselect.
|
boolean |
needSetLongWorkaround()
Checks whether we need a workaround for the (Ingres) setLong-Bug.
|
boolean |
needTxForFetchsize()
Checks for the (postgres) bug that fetchsize is ignored if not within a new transaction.
|
String |
optimizeSql(String sql)
Optimize SQL code.
Replace WHERE 1=1 AND/OR to WHERE. |
void |
setDropIfExistsEnabled(boolean dropIfExists)
Some database support drop index/constraint/column IF EXISTS.
This may be useful if migration scripts are generated against non-production databases that contain test indexes etc... Notice, that those temporary DDL changes should better use the temporary prefix (see isTemporaryName(String) in
order to be ignored by the migrator. |
int |
setLeadingSelectParameters(BackendPreparedStatement stmt,
int limit,
int offset)
Sets optional parameters before applying the original parameters.
|
int |
setTrailingSelectParameters(BackendPreparedStatement stmt,
int index,
int limit,
int offset)
Sets optional parameters after applying the original parameters.
|
String |
sqlAddColumn(String tableName,
String columnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue)
Generates sql code to add a column.
|
String |
sqlAlterColumnComment(String tableName,
String columnName,
String comment)
Generates SQL code to alter the comment for an attribute.
|
String |
sqlAlterColumnDefault(String tableName,
String columnName,
SqlType sqlType,
Object defaultValue)
Generates sql code to change the default value a column.
|
String |
sqlAlterColumnNullConstraint(String tableName,
String columnName,
boolean nullable)
Generates sql code to change the null-constraint of a column.
|
String |
sqlAlterColumnType(String tableName,
String columnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue)
Generates sql code to change the datatype of a column.
|
String |
sqlAlterTableComment(String tableName,
String comment)
Generates SQL code to alter the comment for a table.
|
String |
sqlAsBeforeTableAlias()
Gets the string before the table alias.
In most databases the " AS " is optional and some don't accept it all. |
String |
sqlComment(String text)
Create comment sql code that is interpreted as a comment by the backend.
|
String |
sqlCreateColumn(String columnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue,
boolean primaryKey,
boolean withTrailingComma)
Generates the attribute definition of a CREATE TABLE statement.
|
String |
sqlCreateColumnComment(String tableName,
String columnName,
String comment)
Generates SQL code to create the comment for an attribute.
|
String |
sqlCreateForeignKey(String referencingTableName,
String referencingColumnName,
String referencedTableName,
String referencedColumnName,
String foreignKeyName,
boolean composite)
Generates the ALTER TABLE statement to add a foreign key constraint.
|
String |
sqlCreateIndex(String tableName,
String indexName,
boolean unique,
String filterCondition,
String... columnNames)
Generates the CREATE INDEX statement.
|
String |
sqlCreateTableClosing(String tableName,
String comment)
Generates the last line of a CREATE TABLE statement.
|
String |
sqlCreateTableComment(String tableName,
String comment)
Generates SQL code to create the comment for a table.
|
String |
sqlCreateTableIntro(String tableName,
String comment)
Generates the first line of a CREATE TABLE statement.
|
String |
sqlDropColumn(String tableName,
String columnName)
Generates sql code to drop a column.
|
String |
sqlDropForeignKey(String referencingTableName,
String foreignKeyName)
Generates the sql statement to drop a foreign key constraint.
|
String |
sqlDropIndex(String schemaName,
String tableNameWithoutSchema,
String indexName)
Generates the DROP INDEX statement.
|
String |
sqlFunction(String functionName,
String expression)
Creates an sql function expression.
|
String |
sqlJoin(JoinType type,
String joinedTableName,
String joinedTableAlias,
String join)
Creates a join clause.
|
void |
sqlJoinSelects(JoinType type,
boolean addColumns,
StringBuilder select,
String joinSelect,
String joinSelectIdAlias,
String joinAlias,
String join)
Generate SQL code for joining a table to an existing select.
|
String |
sqlJoinSelects(JoinType type,
boolean addColumns,
String select,
String joinSelect,
String joinSelectIdAlias,
String joinAlias,
String join)
Generate SQL code for joining a table to an existing select.
|
String |
sqlNextFromSequene(String name)
Creates the SQL string to retrieve the next id from a sequence.
|
String |
sqlRenameAndAlterColumnType(String tableName,
String oldColumnName,
String newColumnName,
String comment,
SqlType sqlType,
int size,
int scale,
boolean nullable,
Object defaultValue)
Generates sql code to rename a column.
|
String |
sqlRenameColumn(String tableName,
String oldColumnName,
String newColumnName)
Generates sql code to rename a column.
|
String |
sqlRenameIndex(String tableName,
String oldIndexName,
String newIndexName)
Generates sql code to rename an index.
|
boolean |
sqlRequiresExtraCommit()
According to the JDBC-specs
Connection.setAutoCommit(boolean)(true)
should commit, but some backends require an extra Connection.commit(). |
boolean |
sqlResultSetIsClosedSupported()
Determines whether the jdbc driver supports
ResultSet.isClosed(). |
String |
sqlTypeToString(SqlType sqlType,
int size)
Converts the java SQL-type to the database type name.
|
String |
sqlUpdateToNotNull(String tableName,
String columnName,
SqlType sqlType,
Object defaultValue)
Generates code to update a column to a non-null value.
|
boolean |
supportsSequences()
True if backend provides transactionless sequences.
|
String |
toQuotedString(String str)
Converts a string to a string enclosed in single quotes.
|
String |
valueToLiteral(SqlType sqlType,
Object value)
Conberts a type and value to a literal string.
|
static final String SQL_WHERE
static final String SQL_SELECT
static final String SQL_SELECT_ALL_FROM
static final String SQL_DELETE
static final String SQL_UPDATE
static final String SQL_INSERT_INTO
static final String SQL_LEFT_PARENTHESIS
static final String SQL_RIGHT_PARENTHESIS
static final String SQL_INSERT_VALUES
static final String SQL_SET
static final String SQL_FROM
static final String SQL_AND
static final String SQL_OR
static final String SQL_NOT
static final String SQL_ANDNOT
static final String SQL_ORNOT
static final String SQL_COMMA
static final String SQL_PAR
static final String SQL_EQUAL
static final String SQL_NOTEQUAL
static final String SQL_LESS
static final String SQL_GREATER
static final String SQL_LESSOREQUAL
static final String SQL_GREATEROREQUAL
static final String SQL_LIKE
static final String SQL_NOTLIKE
static final String SQL_EQUAL_ZERO
static final String SQL_NOTEQUAL_ZERO
static final String SQL_COMMA_PAR
static final String SQL_PAR_COMMA
static final String SQL_EQUAL_PAR
static final String SQL_EQUAL_PAR_COMMA
static final String SQL_NOTEQUAL_PAR
static final String SQL_GREATER_PAR
static final String SQL_GREATEROREQUAL_PAR
static final String SQL_LESS_PAR
static final String SQL_LESSOREQUAL_PAR
static final String SQL_LIKE_PAR
static final String SQL_NOTLIKE_PAR
static final String SQL_ALLSTAR
static final String SQL_PLUS_ONE
static final String SQL_WHEREALL
static final String SQL_WHERENOTHING
static final String SQL_WHEREAND
static final String SQL_WHEREOR
static final String SQL_ISNULL
static final String SQL_ISNOTNULL
static final String SQL_ORDERBY
static final String SQL_SORTASC
static final String SQL_SORTDESC
static final String SQL_GROUPBY
static final String SQL_MAX
static final String SQL_MIN
static final String SQL_EXISTS
static final String SQL_ALTER_TABLE
static final String SQL_ALTER_INDEX
static final String SQL_ALTER_COLUMN
static final String SQL_IF_EXISTS
boolean isMatchingUrl(String url)
url - the jdbc urlboolean isMatchingName(String name)
name - the backend's nameString getName()
String getDriverClassName()
Connection createConnection(String url, String username, char[] password) throws SQLException
url - the jdbc urlusername - the usernamepassword - the passwordSQLException - if connection could not be establishedDatabaseMetaData[] getMetaData(BackendInfo backendInfo) throws SQLException
Important: the connection of the metadata is open!
backendInfo - the backend infoSQLException - if failedboolean isTemporaryName(String name)
name - the namevoid buildSelectSql(StringBuilder sqlBuilder, boolean writeLock, int limit, int offset)
sqlBuilder is anything as FROM... WHERE... ORDER BY....
It is decorated with a leading SELECT plus optional clauses
like for the given parameters.
sqlBuilder - the sql builder, initially containing the inner sql without leading SELECT.writeLock - true select should write locklimit - the limit value, ≤ 0 if no limit clauseoffset - the offset value, ≤ 0 if no offset clauseString buildSelectSql(String sql, boolean writeLock, int limit, int offset)
sqlBuilder is anything as FROM... WHERE... ORDER BY....
It is decorated with a leading SELECT plus optional clauses
like for the given parameters.
sql - the sql without leading SELECT.writeLock - true select should write locklimit - the limit value, ≤ 0 if no limit clauseoffset - the offset value, ≤ 0 if no offset clauseint setLeadingSelectParameters(BackendPreparedStatement stmt, int limit, int offset)
stmt - the prepared statementlimit - the limit value, ≤ 0 if no limit clauseoffset - the offset value, ≤ 0 if no offset clauseint setTrailingSelectParameters(BackendPreparedStatement stmt, int index, int limit, int offset)
stmt - the prepared statementindex - the first parameter indexlimit - the limit value, ≤ 0 if no limit clauseoffset - the offset value, ≤ 0 if no offset clauseString getEmptyString()
Some dbms (most famous: Oracle) handle empty strings as null. In such cases the empty string (e.g. Oracle) may consist of a single blank or whatever.
boolean sqlRequiresExtraCommit()
Connection.setAutoCommit(boolean)(true)
should commit, but some backends require an extra Connection.commit().boolean sqlResultSetIsClosedSupported()
ResultSet.isClosed().String getCoalesceKeyword()
boolean allowsExpressionsReferringToTablesBeingUpdated()
boolean supportsSequences()
String sqlAsBeforeTableAlias()
boolean needAliasForSubselect()
String sqlNextFromSequene(String name)
name - the name of the sequenceString sqlComment(String text)
text - any text, single or multilineString sqlJoin(JoinType type, String joinedTableName, String joinedTableAlias, String join)
type - the join typejoinedTableName - the joined tablenamejoinedTableAlias - the joined table alias, null if nonejoin - the join expressionString sqlFunction(String functionName, String expression)
Example:
sqlFunction("max", CN_ID) --> "MAX(id)"
functionName - the function name, will be translated to uppercaseexpression - the expression, may be nullboolean needSetLongWorkaround()
boolean needTxForFetchsize()
boolean isConstraintException(SQLException ex)
ex - the exceptionboolean isCommunicationLinkException(SQLException ex)
ex - the exceptionint getMaxSize(SqlType sqlType)
sqlType - the SQL-typeint getMaxScale(SqlType sqlType, int size)
sqlType - the SQL-typesize - the size, 0 if unlimitedint getDefaultSize(SqlType sqlType)
sqlType - the SQL-typeString getDefaultSchema()
Set<String> getReservedWords()
void assertValidName(SqlNameType nameType, String name)
nameType - the type/usage of the namename - the nameBackendException - if invalid nameString getBackendId(Connection connection)
Useful to figure out the corresponding ManagedConnection from the backend's logfiles.
connection - the jdbc connectionModelMetaData getModelMetaData(DatabaseMetaData[] metaData, String[] schemas, String... tableNames)
metaData - the meta data for the whole databaseschemas - the optional schemas to filter tables, null if no filtertableNames - the tables of the modelColumnMetaData createColumnMetaData(TableMetaData tableMetaData)
tableMetaData - the table meta data this column belongs toTableMetaData createTableMetaData(ModelMetaData metaData, String tableName)
metaData - the whole meta datatableName - the model's table nameIndexMetaData createIndexMetaData(TableMetaData tableMetaData)
tableMetaData - the table meta data this index belongs toIndexColumnMetaData createIndexColumnMetaData(IndexMetaData indexMetaData)
indexMetaData - the meta meta data this column belongs toString sqlTypeToString(SqlType sqlType, int size)
sqlType - the java sql typesize - the column's sizeString columnTypeToString(SqlType sqlType, int size, int scale)
sqlType - the SQL typesize - the sizescale - the scaleString columnTypeNullDefaultToString(String columnName, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue)
columnName - the database column namesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valueString valueToLiteral(SqlType sqlType, Object value)
sqlType - the sql typevalue - the valueString sqlCreateTableIntro(String tableName, String comment)
tableName - the tablename with optional schema separated by a dotcomment - optional comment, null if noneString sqlCreateTableClosing(String tableName, String comment)
tableName - the tablename with optional schema separated by a dotcomment - optional comment, null if noneString sqlCreateTableComment(String tableName, String comment)
tableName - the table namecomment - optional comment, null if nonesqlCreateTableIntro(java.lang.String, java.lang.String) or sqlCreateTableClosing(java.lang.String, java.lang.String)String sqlAlterTableComment(String tableName, String comment)
tableName - the table namecomment - optional comment, null to clearString sqlCreateColumn(String columnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue, boolean primaryKey, boolean withTrailingComma)
columnName - the database column namecomment - optional comment, null if nonesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valueprimaryKey - true if this is a primary keywithTrailingComma - true if append a commaboolean isDefaultEqual(ColumnMetaData column, SqlType sqlType, Object defaultValue)
column - the column to inspectsqlType - the sql typedefaultValue - the model's default valueMigrationStrategy[] getMigrationStrategy(ColumnMetaData column, String columnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue)
column - old column meta datacolumnName - new column namecomment - new commentsqlType - new sql typesize - new sizescale - new scalenullable - new nullabledefaultValue - new defaultString sqlRenameColumn(String tableName, String oldColumnName, String newColumnName)
tableName - the tablenameoldColumnName - the old column namenewColumnName - the new column nameString sqlRenameIndex(String tableName, String oldIndexName, String newIndexName)
tableName - the tablenameoldIndexName - the old column namenewIndexName - the new column nameString sqlRenameAndAlterColumnType(String tableName, String oldColumnName, String newColumnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue)
tableName - the tablenameoldColumnName - the old column namenewColumnName - the new column namecomment - optional comment, null if nonesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valueString sqlAddColumn(String tableName, String columnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue)
tableName - the tablenamecolumnName - the new column namecomment - optional comment, null if nonesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valueString sqlDropColumn(String tableName, String columnName)
tableName - the tablenamecolumnName - the new column nameString sqlAlterColumnType(String tableName, String columnName, String comment, SqlType sqlType, int size, int scale, boolean nullable, Object defaultValue)
tableName - the tablenamecolumnName - the new column namecomment - optional comment, null if nonesqlType - the JDBC sql typesize - the optional sizescale - the optional scalenullable - true if NULL, else NOT NULLdefaultValue - the optional default valueString sqlUpdateToNotNull(String tableName, String columnName, SqlType sqlType, Object defaultValue)
tableName - the tablenamecolumnName - the column namesqlType - the sql typedefaultValue - the optional default value if defined in the modelString sqlAlterColumnNullConstraint(String tableName, String columnName, boolean nullable)
tableName - the tablenamecolumnName - the new column namenullable - true if NULL, else NOT NULLsqlAlterColumnType(java.lang.String, java.lang.String, java.lang.String, org.tentackle.sql.SqlType, int, int, boolean, java.lang.Object)String sqlAlterColumnDefault(String tableName, String columnName, SqlType sqlType, Object defaultValue)
tableName - the tablenamecolumnName - the new column namesqlType - the JDBC sql typedefaultValue - the optional default valuesqlAlterColumnType(java.lang.String, java.lang.String, java.lang.String, org.tentackle.sql.SqlType, int, int, boolean, java.lang.Object)String sqlCreateColumnComment(String tableName, String columnName, String comment)
tableName - the table namecolumnName - the column namecomment - optional comment, null if nonesqlCreateColumn(java.lang.String, java.lang.String, org.tentackle.sql.SqlType, int, int, boolean, java.lang.Object, boolean, boolean)String sqlCreateIndex(String tableName, String indexName, boolean unique, String filterCondition, String... columnNames)
tableName - the table nameindexName - the name of the indexunique - true if index is uniquefilterCondition - the filter condition (null if none)columnNames - the column names (with a leading '-' if descending)String sqlDropIndex(String schemaName, String tableNameWithoutSchema, String indexName)
schemaName - the optional schema, null if nonetableNameWithoutSchema - the table name without the schemaindexName - the name of the indexString sqlCreateForeignKey(String referencingTableName, String referencingColumnName, String referencedTableName, String referencedColumnName, String foreignKeyName, boolean composite)
referencingTableName - the referencing foreign table namereferencingColumnName - the referencing foreign column namereferencedTableName - the referenced primary table namereferencedColumnName - the referenced primary column nameforeignKeyName - the name of the foreign keycomposite - true if referencing table is a component of the referenced tableString sqlDropForeignKey(String referencingTableName, String foreignKeyName)
referencingTableName - the referencing foreign table nameforeignKeyName - the name of the foreign keyString sqlAlterColumnComment(String tableName, String columnName, String comment)
tableName - the table namecolumnName - the column namecomment - optional comment, null to clearsqlRenameAndAlterColumnType(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.tentackle.sql.SqlType, int, int, boolean, java.lang.Object) insteadvoid sqlJoinSelects(JoinType type, boolean addColumns, StringBuilder select, String joinSelect, String joinSelectIdAlias, String joinAlias, String join)
type - the join typeaddColumns - true if columns of joined table should be added to the result setselect - the original select statementjoinSelect - the select to join with the original sql or just a tablenamejoinSelectIdAlias - extra id alias to add to the joined select, null if nonejoinAlias - the alias of the joined selectjoin - the join clauseString sqlJoinSelects(JoinType type, boolean addColumns, String select, String joinSelect, String joinSelectIdAlias, String joinAlias, String join)
type - the join typeaddColumns - true if columns of joined table should be added to the result setselect - the original select statementjoinSelect - the select to join with the original sql or just a tablenamejoinSelectIdAlias - extra id alias to add to the joined select, null if nonejoinAlias - the alias of the joined selectjoin - the join clauseSqlType[] jdbcTypeToSqlType(int jdbcType, int size, int scale)
There may be more than one sqltype returned!
jdbcType - the jdbc data typesize - the column sizescale - the column's scaleTypesTableMetaData getTableMetaData(ModelMetaData modelMetaData, String tableName)
modelMetaData - the model the table belongs totableName - the model's table nameString toQuotedString(String str)
str - the stringString optimizeSql(String sql)
sql - the original sql codeboolean isReleaseSavepointSupported()
void setDropIfExistsEnabled(boolean dropIfExists)
isTemporaryName(String) in
order to be ignored by the migrator.dropIfExists - true if use IF EXISTS if the backend supports itboolean isDropIfExistsEnabled()
Tentackle - distributed, domain- and model-driven