Top Description Inners Constructors Methods
liquibase.sqlgenerator.core

public Class CreateIndexGeneratorFirebird

extends CreateIndexGenerator
Class Inheritance
Imports
liquibase.change.AddColumnConfig, .ColumnConfig, liquibase.database.Database, liquibase.database.core.FirebirdDatabase, liquibase.exception.ValidationErrors, liquibase.sql.Sql, .UnparsedSql, liquibase.sqlgenerator.SqlGeneratorChain, liquibase.statement.core.CreateIndexStatement, liquibase.structure.core.Index, liquibase.util.StringUtil, java.util.Arrays, .Iterator, .List

Firebird-specific CREATE INDEX SQL generator.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private CreateIndexGeneratorFirebird.ColumnAnalysisResult

Returns:

the result of the analysis
analyseColumns
(CreateIndexStatement
the CreateIndexStatement to analyse
statement
,
Database
the Database object (FirebirdDatabase is expected)
database
)

Analyzes the column list for the statement and returns a ColumnAnalysisResult which contains: - The final column list (or computed expression) - How many regular columns were found - How many computed expressions were found - If any column had an ASCending sorting - If any column had a DESCending sorting

private boolean

Returns:

true if it is more likely an expression, false if it is more likely a column name (identifier).
applyIsComputedExpressionHeuristic
(ColumnConfig column, Database database)

An imperfect heuristic to determine if an expression is more likely a column name or a computed expression.

public Sql[]

Returns:

An array with one entry containing the generated CREATE INDEX statement for Firebird.
generateSql
(CreateIndexStatement
A CreateIndexStatement with the desired properties of the SQL to be generated
statement
,
Database
A database object (must be of FirebirdDatabase type, or we will error out)
database
,
SqlGeneratorChain<T extends SqlStatement>
The other generators in the current chain (ignored by this implementation)
sqlGeneratorChain
)

Overrides liquibase.sqlgenerator.core.CreateIndexGenerator.generateSql.

Implements liquibase.sqlgenerator.SqlGenerator.generateSql.

Generate a CREATE INDEX SQL statement for Firebird databases.

public int

Returns:

The PRIORITY_DATABASE priority
getPriority
()

Overrides liquibase.sqlgenerator.core.AbstractSqlGenerator.getPriority.

Implements liquibase.sqlgenerator.SqlGenerator.getPriority.

Informs the SqlGeneratorFactory that we are the preferred generator for CREATE INDEX statements in a Firebird database.

public boolean

Returns:

true if database is a Firebird database, else in other cases.
supports
(CreateIndexStatement
The SqlStatement object (ignored in this case)
statement
,
Database
The database object to be compared
database
)

Overrides liquibase.sqlgenerator.core.AbstractSqlGenerator.supports.

Implements liquibase.sqlgenerator.SqlGenerator.supports.

Informs the SqlGeneratorFactory that we this class works on Firebird SQL databases only.

public ValidationErrors
validate(CreateIndexStatement createIndexStatement, Database database, SqlGeneratorChain<T extends SqlStatement> sqlGeneratorChain)

Overrides liquibase.sqlgenerator.core.CreateIndexGenerator.validate.

Implements liquibase.sqlgenerator.SqlGenerator.validate.

Validate the data contained in the SqlStatement.

Inherited from liquibase.sqlgenerator.core.CreateIndexGenerator:
getAffectedIndexwarn

Constructor Detail

CreateIndexGeneratorFirebirdback to summary
public CreateIndexGeneratorFirebird()

Method Detail

analyseColumnsback to summary
private CreateIndexGeneratorFirebird.ColumnAnalysisResult analyseColumns(CreateIndexStatement statement, Database database)

Analyzes the column list for the statement and returns a ColumnAnalysisResult which contains: - The final column list (or computed expression) - How many regular columns were found - How many computed expressions were found - If any column had an ASCending sorting - If any column had a DESCending sorting

Parameters
statement:CreateIndexStatement

the CreateIndexStatement to analyse

database:Database

the Database object (FirebirdDatabase is expected)

Returns:CreateIndexGeneratorFirebird.ColumnAnalysisResult

the result of the analysis

applyIsComputedExpressionHeuristicback to summary
private boolean applyIsComputedExpressionHeuristic(ColumnConfig column, Database database)

An imperfect heuristic to determine if an expression is more likely a column name or a computed expression.

Returns:boolean

true if it is more likely an expression, false if it is more likely a column name (identifier).

generateSqlback to summary
public Sql[] generateSql(CreateIndexStatement statement, Database database, SqlGeneratorChain<T extends SqlStatement> sqlGeneratorChain)

Overrides liquibase.sqlgenerator.core.CreateIndexGenerator.generateSql.

Implements liquibase.sqlgenerator.SqlGenerator.generateSql.

Generate a CREATE INDEX SQL statement for Firebird databases.

Parameters
statement:CreateIndexStatement

A CreateIndexStatement with the desired properties of the SQL to be generated

database:Database

A database object (must be of FirebirdDatabase type, or we will error out)

sqlGeneratorChain:SqlGeneratorChain<T extends SqlStatement>

The other generators in the current chain (ignored by this implementation)

Returns:Sql[]

An array with one entry containing the generated CREATE INDEX statement for Firebird.

Annotations
@Override
getPriorityback to summary
public int getPriority()

Overrides liquibase.sqlgenerator.core.AbstractSqlGenerator.getPriority.

Implements liquibase.sqlgenerator.SqlGenerator.getPriority.

Informs the SqlGeneratorFactory that we are the preferred generator for CREATE INDEX statements in a Firebird database.

Returns:int

The PRIORITY_DATABASE priority

Annotations
@Override
supportsback to summary
public boolean supports(CreateIndexStatement statement, Database database)

Overrides liquibase.sqlgenerator.core.AbstractSqlGenerator.supports.

Implements liquibase.sqlgenerator.SqlGenerator.supports.

Informs the SqlGeneratorFactory that we this class works on Firebird SQL databases only.

Parameters
statement:CreateIndexStatement

The SqlStatement object (ignored in this case)

database:Database

The database object to be compared

Returns:boolean

true if database is a Firebird database, else in other cases.

Annotations
@Override
validateback to summary
public ValidationErrors validate(CreateIndexStatement createIndexStatement, Database database, SqlGeneratorChain<T extends SqlStatement> sqlGeneratorChain)

Overrides liquibase.sqlgenerator.core.CreateIndexGenerator.validate.

Implements liquibase.sqlgenerator.SqlGenerator.validate.

Doc from liquibase.sqlgenerator.SqlGenerator.validate.

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.

Annotations
@Override
liquibase.sqlgenerator.core back to summary

private final Class CreateIndexGeneratorFirebird.ColumnAnalysisResult

extends Object
Class Inheritance
  • java.lang.Object
  • liquibase.sqlgenerator.core.CreateIndexGeneratorFirebird.ColumnAnalysisResult

Field Summary

Modifier and TypeField and Description
private String
private boolean
private boolean
private int
private int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
public int
public int
public boolean
public boolean
public void
setColumnExpression(String columnExpression)

public void
setFoundAscColumns(boolean foundAscColumns)

public void
setFoundDescColumns(boolean foundDescColumns)

public void
setNumComputedCols(int numComputedCols)

public void
setNumRegularCols(int numRegularCols)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnExpressionback to summary
private String columnExpression
foundAscColumnsback to summary
private boolean foundAscColumns
foundDescColumnsback to summary
private boolean foundDescColumns
numComputedColsback to summary
private int numComputedCols
numRegularColsback to summary
private int numRegularCols

Constructor Detail

ColumnAnalysisResultback to summary
private ColumnAnalysisResult()

Method Detail

getColumnExpressionback to summary
public String getColumnExpression()
getNumComputedColsback to summary
public int getNumComputedCols()
getNumRegularColsback to summary
public int getNumRegularCols()
isFoundAscColumnsback to summary
public boolean isFoundAscColumns()
isFoundDescColumnsback to summary
public boolean isFoundDescColumns()
setColumnExpressionback to summary
public void setColumnExpression(String columnExpression)
setFoundAscColumnsback to summary
public void setFoundAscColumns(boolean foundAscColumns)
setFoundDescColumnsback to summary
public void setFoundDescColumns(boolean foundDescColumns)
setNumComputedColsback to summary
public void setNumComputedCols(int numComputedCols)
setNumRegularColsback to summary
public void setNumRegularCols(int numRegularCols)