Search in sources :

Example 1 with StatementSequenceValidatorResult

use of com.robotoworks.mechanoid.db.validation.StatementSequenceValidatorResult in project mechanoid by robotoworks.

the class StatementSequenceValidator method validate.

public StatementSequenceValidatorResult validate(final DatabaseBlock db) {
    this.tables.clear();
    this.views.clear();
    this.triggers.clear();
    this.indexes.clear();
    StatementSequenceValidatorResult result = new StatementSequenceValidatorResult();
    result.valid = true;
    EList<MigrationBlock> _migrations = db.getMigrations();
    for (final MigrationBlock migration : _migrations) {
        {
            EList<DDLStatement> statements = migration.getStatements();
            for (final DDLStatement stmt : statements) {
                {
                    result.source = stmt;
                    this.validateStatement(result, stmt);
                    if (result.valid) {
                        this.sequence(stmt);
                    } else {
                        return result;
                    }
                }
            }
        }
    }
    return result;
}
Also used : EList(org.eclipse.emf.common.util.EList) DDLStatement(com.robotoworks.mechanoid.db.sqliteModel.DDLStatement) MigrationBlock(com.robotoworks.mechanoid.db.sqliteModel.MigrationBlock) StatementSequenceValidatorResult(com.robotoworks.mechanoid.db.validation.StatementSequenceValidatorResult)

Aggregations

DDLStatement (com.robotoworks.mechanoid.db.sqliteModel.DDLStatement)1 MigrationBlock (com.robotoworks.mechanoid.db.sqliteModel.MigrationBlock)1 StatementSequenceValidatorResult (com.robotoworks.mechanoid.db.validation.StatementSequenceValidatorResult)1 EList (org.eclipse.emf.common.util.EList)1