T
- Used to specify which type of SqlStatement this generator supports.
If it supports multiple SqlStatement types, pass SqlStatement. The SqlGeneratorFactory will use this parameter
to augment the response from the supports() methodpublic interface SqlGenerator<T extends SqlStatement> extends PrioritizedService
The SqlGenerator implementations are responsible for determining whether the data contained in the SqlStatement method is valid using the validate method.
Naming Conventions:
Default SqlGenerators for a particular SqlStatement use the same name as the SqlStatement class, replacing
"Statement" with "Generator" (e.g.: CreateTableStatement -> CreateTableGenerator).
Database-specific or alternate SqlGenerators append a description of what makes them different appended
(e.g. CreateTableStatement -> CreateTableGeneratorOracle)
NOTE: There is only one instance of each SqlGenerator implementation created, and they must be thread safe.
Lifecycle:
SqlGeneratorFactory
,
SqlStatement
,
Sql
Modifier and Type | Field and Description |
---|---|
static Sql[] |
EMPTY_SQL
Represent an empty array of
Sql . |
static int |
PRIORITY_DATABASE |
static int |
PRIORITY_DEFAULT |
COMPARATOR
Modifier and Type | Method and Description |
---|---|
boolean |
generateRollbackStatementsIsVolatile(Database database) |
Sql[] |
generateSql(T statement,
Database database,
SqlGeneratorChain<T> sqlGeneratorChain)
Generate the actual Sql for the given statement and database.
|
boolean |
generateStatementsIsVolatile(Database database)
Does this change require access to the database metadata? If true, the change cannot be used in an
updateSql-style command.
|
int |
getPriority()
Of all the SqlGenerators that "support" a given SqlStatement/Database, SqlGeneratorFactory will return the one
with the highest priority.
|
boolean |
supports(T statement,
Database database)
Does this generator support the given statement/database combination? Do not validate the statement with this
method, only return if it can support it.
|
ValidationErrors |
validate(T statement,
Database database,
SqlGeneratorChain<T> sqlGeneratorChain)
Validate the data contained in the SqlStatement.
|
Warnings |
warn(T statementType,
Database database,
SqlGeneratorChain<T> sqlGeneratorChain) |
static final int PRIORITY_DEFAULT
static final int PRIORITY_DATABASE
int getPriority()
getPriority
in interface PrioritizedService
boolean supports(T statement, Database database)
boolean generateStatementsIsVolatile(Database database)
boolean generateRollbackStatementsIsVolatile(Database database)
ValidationErrors validate(T statement, Database database, SqlGeneratorChain<T> sqlGeneratorChain)
Warnings warn(T statementType, Database database, SqlGeneratorChain<T> sqlGeneratorChain)
Sql[] generateSql(T statement, Database database, SqlGeneratorChain<T> sqlGeneratorChain)
Copyright © 2023 Liquibase.org. All rights reserved.