Package liquibase.sqlgenerator.core
Class AbstractSqlGenerator<T extends SqlStatement>
java.lang.Object
liquibase.sqlgenerator.core.AbstractSqlGenerator<T>
- Type Parameters:
T
- an implementation of theSqlStatement
specifying which logical SQL statement an instance of this template class is able to generate SQL for.
- All Implemented Interfaces:
PrioritizedService
,SqlGenerator<T>
- Direct Known Subclasses:
AddAutoIncrementGenerator
,AddColumnGenerator
,AddDefaultValueGenerator
,AddForeignKeyConstraintGenerator
,AddPrimaryKeyGenerator
,AddUniqueConstraintGenerator
,AlterSequenceGenerator
,BatchDmlExecutablePreparedStatementGenerator
,ClearDatabaseChangeLogTableGenerator
,CommentGenerator
,CopyRowsGenerator
,CreateDatabaseChangeLogLockTableGenerator
,CreateDatabaseChangeLogTableGenerator
,CreateDatabaseChangeLogTableGeneratorSybase
,CreateIndexGenerator
,CreateProcedureGenerator
,CreateSequenceGenerator
,CreateTableGenerator
,CreateViewGenerator
,CreateViewGeneratorInformix
,DeleteGenerator
,DropColumnGenerator
,DropDefaultValueGenerator
,DropForeignKeyConstraintGenerator
,DropIndexGenerator
,DropPrimaryKeyGenerator
,DropProcedureGenerator
,DropSequenceGenerator
,DropTableGenerator
,DropUniqueConstraintGenerator
,DropViewGenerator
,GetNextChangeSetSequenceValueGenerator
,GetViewDefinitionGenerator
,InitializeDatabaseChangeLogLockTableGenerator
,InsertDataChangeGenerator
,InsertGenerator
,InsertOrUpdateGenerator
,InsertSetGenerator
,LockDatabaseChangeLogGenerator
,MarkChangeSetRanGenerator
,ModifyDataTypeGenerator
,RawParameterizedSqlGenerator
,RawSqlGenerator
,ReindexGeneratorSQLite
,RemoveChangeSetRanStatusGenerator
,RenameColumnGenerator
,RenameSequenceGenerator
,RenameTableGenerator
,RenameViewGenerator
,ReorganizeTableGeneratorDB2
,RuntimeGenerator
,SelectFromDatabaseChangeLogGenerator
,SelectFromDatabaseChangeLogLockGenerator
,SetColumnRemarksGenerator
,SetNullableGenerator
,SetTableRemarksGenerator
,SetViewRemarksGenerator
,StoredProcedureGenerator
,TableIsEmptyGenerator
,TableRowCountGenerator
,TagDatabaseGenerator
,UnlockDatabaseChangeLogGenerator
,UpdateChangeSetChecksumGenerator
,UpdateDataChangeGenerator
,UpdateGenerator
public abstract class AbstractSqlGenerator<T extends SqlStatement>
extends Object
implements SqlGenerator<T>
Generic template class for an SQL generator able to generate SQL for an object-form
SqlStatement
.-
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 TypeMethodDescriptionboolean
generateRollbackStatementsIsVolatile
(Database database) boolean
generateStatementsIsVolatile
(Database database) Does this change require access to the database metadata?int
Of all the SqlGenerators that "support" a given SqlStatement/Database, SqlGeneratorFactory will return the one with the highest priority.boolean
looksLikeFunctionCall
(String value, Database database) Tries to find out if a given value (part a database-specific SQL statement) is just a simple literal (e.g.boolean
Does this generator support the given statement/database combination?warn
(T statementType, Database database, SqlGeneratorChain<T> sqlGeneratorChain) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface liquibase.sqlgenerator.SqlGenerator
generateSql, validate
-
Constructor Details
-
AbstractSqlGenerator
public AbstractSqlGenerator()
-
-
Method Details
-
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<T extends SqlStatement>
-
generateStatementsIsVolatile
Description copied from interface:SqlGenerator
Does this change require access to the database metadata? If true, the change cannot be used in an updateSql-style command.- Specified by:
generateStatementsIsVolatile
in interfaceSqlGenerator<T extends SqlStatement>
-
generateRollbackStatementsIsVolatile
- Specified by:
generateRollbackStatementsIsVolatile
in interfaceSqlGenerator<T extends SqlStatement>
-
supports
Description copied from interface:SqlGenerator
Does this generator support the given statement/database combination? Do not validate the statement with this method, only return if it can support it.- Specified by:
supports
in interfaceSqlGenerator<T extends SqlStatement>
-
warn
- Specified by:
warn
in interfaceSqlGenerator<T extends SqlStatement>
-
looksLikeFunctionCall
Tries to find out if a given value (part a database-specific SQL statement) is just a simple literal (e.g. 'Jones', 149.99 or false) or if it is a call to a function within the database (e.g. TO_DATE('28.12.2017', 'dd.mm.yyyy') in Oracle DB). This method is often used to determine if we need to quote literals which are Strings, e.g. if we determine "Dr. Jones" to be a literal, then we generate
but if the value is a function call, we may not quote it, e.g. for "TO_DATE('28.12.2017', 'dd.mm.yyyy')", we need to generate (note the absence of the apostrophes!):INSERT INTO customers(last_name) VALUES('Dr. Jones')
INSERT INTO bookings(booking_date) VALUES (TO_DATE('28.12.2017', 'dd.mm.yyyy'))
- Parameters:
value
- The string to testdatabase
- the database object to test against- Returns:
- true if value looks like a function call, false if it looks like a literal.
-