StatementType
- Used to specify which type of SqlStatement this generator supports.
If it supports multiple SqlStatement types, pass SqlStatement. The SqlGeneratorFactory will use this paramter to augment the response from the supports() methodpublic interface SqlGenerator<StatementType 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 descrition 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 int |
PRIORITY_DATABASE |
static int |
PRIORITY_DEFAULT |
COMPARATOR
Modifier and Type | Method and Description |
---|---|
boolean |
generateRollbackStatementsIsVolatile(Database database) |
Sql[] |
generateSql(StatementType statement,
Database database,
SqlGeneratorChain 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(StatementType 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 suppot it.
|
ValidationErrors |
validate(StatementType statement,
Database database,
SqlGeneratorChain sqlGeneratorChain)
Validate the data contained in the SqlStatement.
|
Warnings |
warn(StatementType statementType,
Database database,
SqlGeneratorChain sqlGeneratorChain) |
static final int PRIORITY_DEFAULT
static final int PRIORITY_DATABASE
int getPriority()
getPriority
in interface PrioritizedService
boolean supports(StatementType statement, Database database)
boolean generateStatementsIsVolatile(Database database)
boolean generateRollbackStatementsIsVolatile(Database database)
ValidationErrors validate(StatementType statement, Database database, SqlGeneratorChain sqlGeneratorChain)
Warnings warn(StatementType statementType, Database database, SqlGeneratorChain sqlGeneratorChain)
Sql[] generateSql(StatementType statement, Database database, SqlGeneratorChain sqlGeneratorChain)
Copyright © 2016 Liquibase.org. All rights reserved.