Package liquibase.sqlgenerator.core
Class InsertOrUpdateGenerator
java.lang.Object
liquibase.sqlgenerator.core.AbstractSqlGenerator<InsertOrUpdateStatement>
liquibase.sqlgenerator.core.InsertOrUpdateGenerator
- All Implemented Interfaces:
PrioritizedService
,SqlGenerator<InsertOrUpdateStatement>
- Direct Known Subclasses:
InsertOrUpdateGeneratorDB2
,InsertOrUpdateGeneratorH2
,InsertOrUpdateGeneratorHsql
,InsertOrUpdateGeneratorInformix
,InsertOrUpdateGeneratorMSSQL
,InsertOrUpdateGeneratorMySQL
,InsertOrUpdateGeneratorOracle
,InsertOrUpdateGeneratorPostgres
,InsertOrUpdateGeneratorSnowflake
,InsertOrUpdateGeneratorSQLite
,InsertOrUpdateGeneratorSybaseASA
-
Field Summary
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR
Fields inherited from interface liquibase.sqlgenerator.SqlGenerator
EMPTY_SQL, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSql[]
generateSql
(InsertOrUpdateStatement insertOrUpdateStatement, Database database, SqlGeneratorChain sqlGeneratorChain) Generate the actual Sql for the given statement and database.protected Table
getAffectedTable
(InsertOrUpdateStatement insertOrUpdateStatement) protected abstract String
protected String
getInsertStatement
(InsertOrUpdateStatement insertOrUpdateStatement, Database database, SqlGeneratorChain sqlGeneratorChain) protected String
getPostUpdateStatements
(Database database) int
Of all the SqlGenerators that "support" a given SqlStatement/Database, SqlGeneratorFactory will return the one with the highest priority.protected abstract String
getRecordCheck
(InsertOrUpdateStatement insertOrUpdateStatement, Database database, String whereClause) protected String
getUpdateStatement
(InsertOrUpdateStatement insertOrUpdateStatement, Database database, String whereClause, SqlGeneratorChain sqlGeneratorChain) Generates an SQL UPDATE statement for the specified insert or update statement, database, and SQL generator chain.protected String
getWhereClause
(InsertOrUpdateStatement insertOrUpdateStatement, Database database) validate
(InsertOrUpdateStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) Validate the data contained in the SqlStatement.Methods inherited from class liquibase.sqlgenerator.core.AbstractSqlGenerator
generateRollbackStatementsIsVolatile, generateStatementsIsVolatile, looksLikeFunctionCall, supports, warn
-
Constructor Details
-
InsertOrUpdateGenerator
public InsertOrUpdateGenerator()
-
-
Method Details
-
getRecordCheck
protected abstract String getRecordCheck(InsertOrUpdateStatement insertOrUpdateStatement, Database database, String whereClause) -
getElse
-
getPostUpdateStatements
-
getPriority
public int getPriority()Description copied from interface:SqlGenerator
Of all the SqlGenerators that "support" a given SqlStatement/Database, SqlGeneratorFactory will return the one with the highest priority.- Specified by:
getPriority
in interfacePrioritizedService
- Specified by:
getPriority
in interfaceSqlGenerator<InsertOrUpdateStatement>
- Overrides:
getPriority
in classAbstractSqlGenerator<InsertOrUpdateStatement>
-
validate
public ValidationErrors validate(InsertOrUpdateStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) Description copied from interface:SqlGenerator
Validate the data contained in the SqlStatement. If there are no errors, return an empty ValidationErrors object, not a null value. Liquibase will inspect the ValidationErrors result before attempting to call generateSql. -
getWhereClause
-
getInsertStatement
protected String getInsertStatement(InsertOrUpdateStatement insertOrUpdateStatement, Database database, SqlGeneratorChain sqlGeneratorChain) -
getUpdateStatement
protected String getUpdateStatement(InsertOrUpdateStatement insertOrUpdateStatement, Database database, String whereClause, SqlGeneratorChain sqlGeneratorChain) throws LiquibaseException Generates an SQL UPDATE statement for the specified insert or update statement, database, and SQL generator chain.- Parameters:
insertOrUpdateStatement
- the insert or update statement to generate the update statement fromdatabase
- the database to generate the update statement forwhereClause
- the WHERE clause to use in the update statementsqlGeneratorChain
- the SQL generator chain to use in the update statement- Returns:
- the generated update statement, or
null
if there is nothing to update - Throws:
LiquibaseException
- if there is an error generating the update statement
-
generateSql
public Sql[] generateSql(InsertOrUpdateStatement insertOrUpdateStatement, Database database, SqlGeneratorChain sqlGeneratorChain) Description copied from interface:SqlGenerator
Generate the actual Sql for the given statement and database. -
getAffectedTable
-