@@ -0,0 +1,2757 @@
+package liquibase.sqlgenerator.core;%0A%0Aimport liquibase.database.Database;%0Aimport liquibase.database.core.FirebirdDatabase;%0Aimport liquibase.exception.ValidationErrors;%0Aimport liquibase.sql.Sql;%0Aimport liquibase.sql.UnparsedSql;%0Aimport liquibase.sqlgenerator.SqlGeneratorChain;%0Aimport liquibase.statement.core.FindForeignKeyConstraintsStatement;%0A%0Apublic class FindForeignKeyConstraintsGeneratorFirebird extends AbstractSqlGenerator%3CFindForeignKeyConstraintsStatement%3E %7B%0A    @Override%0A    public int getPriority() %7B%0A        return PRIORITY_DATABASE;%0A    %7D%0A%0A    @Override%0A    public boolean supports(FindForeignKeyConstraintsStatement statement, Database database) %7B%0A        return database instanceof FirebirdDatabase;%0A    %7D%0A%0A    @Override%0A    public ValidationErrors validate(FindForeignKeyConstraintsStatement findForeignKeyConstraintsStatement, Database database, SqlGeneratorChain sqlGeneratorChain) %7B%0A        ValidationErrors validationErrors = new ValidationErrors();%0A        validationErrors.checkRequiredField(%22baseTableName%22, findForeignKeyConstraintsStatement.getBaseTableName());%0A        return validationErrors;%0A    %7D%0A%0A    @Override%0A    public Sql%5B%5D generateSql(FindForeignKeyConstraintsStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) %7B%0A        StringBuilder sb = new StringBuilder();%0A%0A        sb.append(%22SELECT %22);%0A        sb.append(%22a.RDB$RELATION_NAME as %22).append(FindForeignKeyConstraintsStatement.RESULT_COLUMN_BASE_TABLE_NAME).append(%22, %22);%0A        sb.append(%22b.RDB$FIELD_NAME as %22).append(FindForeignKeyConstraintsStatement.RESULT_COLUMN_BASE_TABLE_COLUMN_NAME).append(%22, %22);%0A        sb.append(%22d.RDB$RELATION_NAME as %22).append(FindForeignKeyConstraintsStatement.RESULT_COLUMN_FOREIGN_TABLE_NAME).append(%22, %22);%0A        sb.append(%22e.RDB$FIELD_NAME as %22).append(FindForeignKeyConstraintsStatement.RESULT_COLUMN_FOREIGN_COLUMN_NAME).append(%22,%22);%0A        sb.append(%22a.RDB$CONSTRAINT_NAME as %22).append(FindForeignKeyConstraintsStatement.RESULT_COLUMN_CONSTRAINT_NAME).append(%22 %22);%0A        sb.append(%22FROM (((RDB$RELATION_CONSTRAINTS a LEFT OUTER JOIN RDB$INDEX_SEGMENTS b ON b.RDB$INDEX_NAME = a.RDB$INDEX_NAME) %22);%0A        sb.append(%22LEFT OUTER JOIN RDB$INDICES c ON c.RDB$INDEX_NAME = a.RDB$INDEX_NAME) %22);%0A        sb.append(%22LEFT OUTER JOIN RDB$RELATION_CONSTRAINTS d ON d.RDB$INDEX_NAME = c.RDB$FOREIGN_KEY AND d.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY') %22);%0A        sb.append(%22LEFT OUTER JOIN RDB$INDEX_SEGMENTS e ON e.RDB$INDEX_NAME = d.RDB$INDEX_NAME AND e.RDB$FIELD_POSITION = b.RDB$FIELD_POSITION %22);%0A        sb.append(%22WHERE a.RDB$RELATION_NAME='%22).append(statement.getBaseTableName()).append(%22' AND a.RDB$CONSTRAINT_TYPE = 'FOREIGN KEY'%22);%0A%0A        return new Sql%5B%5D %7B new UnparsedSql(sb.toString()) %7D;%0A    %7D%0A%7D

Implement FindForeignKeyConstraintsGenerator for Firebird (CORE-2070)