liquibase-core/src/main/java/liquibase/sqlgenerator/core/CreateIndexGeneratorFirebird.java
private ColumnAnalysisResult analyseColumns(CreateIndexStatement statement,
                                                Database database)  {
        ColumnAnalysisResult result = new ColumnAnalysisResult();

        StringBuffer idxColsBuf = new StringBuffer();
        result.foundAscColumns = false;
        result.foundDescColumns = false;
        result.numComputedCols = 0;
        result.numRegularCols = 0;

        Iterator<AddColumnConfig> iterator = Arrays.asList(statement.getColumns()).iterator();

        while (iterator.hasNext()) {
            AddColumnConfig column = iterator.next();
            boolean columnExpressionIsComputed;
            if (column.getComputed() == null) {
                /* We absolutely must know whether we have a column identifier or something else (expression index)
                 * in front of us, because the correct syntax depends on it.
                 */
                columnExpressionIsComputed = applyIsComputedExpressionHeuristic(column, database);
            } else {
                columnExpressionIsComputed = column.getComputed();
            }

            if (columnExpressionIsComputed) {
                idxColsBuf.append(column.getName()); // Use the expression as-is
                result.setNumComputedCols(result.getNumComputedCols()+1);
            } else {
                result.setNumRegularCols((result.getNumRegularCols())+1);
                idxColsBuf.append(database.escapeColumnName(statement.getTableCatalogName(), statement.getTableSchemaName(), statement.getTableName(), column.getName()));
            }

            if ((column.getDescending() != null) && column.getDescending()) {
                result.setFoundDescColumns(true);
            } else {
                result.setFoundAscColumns(true);
            }

            if (iterator.hasNext()) {
                idxColsBuf.append(", ");
            }
        }

        result.setColumnExpression(idxColsBuf.toString());
        return result;
    }
private ColumnAnalysisResult analyseColumns(CreateIndexStatement statement,
                                                Database database)  {
        ColumnAnalysisResult result = new ColumnAnalysisResult();

        StringBuffer idxColsBuf = new StringBuffer();
        result.foundAscColumns = false;
        result.foundDescColumns = false;
        result.numComputedCols = 0;
        result.numRegularCols = 0;

        Iterator<AddColumnConfig> iterator = Arrays.asList(statement.getColumns()).iterator();

        while (iterator.hasNext()) {
            AddColumnConfig column = iterator.next();
            boolean columnExpressionIsComputed;
            if (column.getComputed() == null) {
                /* We absolutely must know whether we have a column identifier or something else (expression index)
                 * in front of us, because the correct syntax depends on it.
                 */
                columnExpressionIsComputed = applyIsComputedExpressionHeuristic(column, database);
            } else {
                columnExpressionIsComputed = column.getComputed();
            }

            if (columnExpressionIsComputed) {
                idxColsBuf.append(column.getName()); // Use the expression as-is
                result.setNumComputedCols(result.getNumComputedCols()+1);
            } else {
                result.setNumRegularCols((result.getNumRegularCols())+1);
                idxColsBuf.append(database.escapeColumnName(statement.getTableCatalogName(), statement.getTableSchemaName(), statement.getTableName(), column.getName()));
            }

            if ((column.getDescending() != null) && column.getDescending()) {
                result.setFoundDescColumns(true);
            } else {
                result.setFoundAscColumns(true);
            }

            if (iterator.hasNext()) {
                idxColsBuf.append(", ");
            }
        }

        result.setColumnExpression(idxColsBuf.toString());
        return result;
    }
private ColumnAnalysisResult analyseColumns ( CreateIndexStatement statement , Database database ) { ColumnAnalysisResult result = new ColumnAnalysisResult ( ) ; StringBuffer idxColsBuf = new StringBuffer ( ) ; result . foundAscColumns = false ; result . foundDescColumns = false ; result . numComputedCols = 0 ; result . numRegularCols = 0 ; Iterator < AddColumnConfig > iterator = Arrays . asList ( statement . getColumns ( ) ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { AddColumnConfig column = iterator . next ( ) ; boolean columnExpressionIsComputed ; if ( column . getComputed ( ) == null ) { /* We absolutely must know whether we have a column identifier or something else (expression index)
                 * in front of us, because the correct syntax depends on it.
                 */ columnExpressionIsComputed = applyIsComputedExpressionHeuristic ( column , database ) ; } else { columnExpressionIsComputed = column . getComputed ( ) ; } if ( columnExpressionIsComputed ) { idxColsBuf . append ( column . getName ( ) ) ; // Use the expression as-is result . setNumComputedCols ( result . getNumComputedCols ( ) + 1 ) ; } else { result . setNumRegularCols ( ( result . getNumRegularCols ( ) ) + 1 ) ; idxColsBuf . append ( database . escapeColumnName ( statement . getTableCatalogName ( ) , statement . getTableSchemaName ( ) , statement . getTableName ( ) , column . getName ( ) ) ) ; } if ( ( column . getDescending ( ) != null ) && column . getDescending ( ) ) { result . setFoundDescColumns ( true ) ; } else { result . setFoundAscColumns ( true ) ; } if ( iterator . hasNext ( ) ) { idxColsBuf . append ( ", " ) ; } } result . setColumnExpression ( idxColsBuf . toString ( ) ) ; return result ; }
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
@param statement the CreateIndexStatement to analyse
@param database the Database object (FirebirdDatabase is expected)
@return the result of the analysis
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