Search in sources :

Example 6 with TableDefinition

use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.

the class StatementSequenceValidator method _validateStatement.

protected void _validateStatement(final StatementSequenceValidatorResult result, final DropTableStatement stmt) {
    TableDefinition _table = stmt.getTable();
    String _name = _table.getName();
    boolean _contains = this.tables.contains(_name);
    boolean _not = (!_contains);
    if (_not) {
        result.valid = false;
        result.message = "No such table";
        result.feature = SqliteModelPackage.Literals.DROP_TABLE_STATEMENT__TABLE;
    }
}
Also used : TableDefinition(com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)

Example 7 with TableDefinition

use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.

the class StatementSequenceValidator method _validateStatement.

protected void _validateStatement(final StatementSequenceValidatorResult result, final AlterTableAddColumnStatement stmt) {
    TableDefinition _table = stmt.getTable();
    String _name = _table.getName();
    boolean _contains = this.tables.contains(_name);
    boolean _not = (!_contains);
    if (_not) {
        result.valid = false;
        result.message = "No such table";
        result.feature = SqliteModelPackage.Literals.ALTER_TABLE_ADD_COLUMN_STATEMENT__TABLE;
    }
}
Also used : TableDefinition(com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)

Example 8 with TableDefinition

use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.

the class StatementSequenceValidator method _validateStatement.

protected void _validateStatement(final StatementSequenceValidatorResult result, final CreateIndexStatement stmt) {
    String _name = stmt.getName();
    boolean _nameExists = this.nameExists(_name);
    if (_nameExists) {
        result.valid = false;
        result.message = "Name conflict, use another name";
        result.feature = SqliteModelPackage.Literals.CREATE_INDEX_STATEMENT__NAME;
    } else {
        TableDefinition _table = stmt.getTable();
        String _name_1 = _table.getName();
        boolean _contains = this.tables.contains(_name_1);
        boolean _not = (!_contains);
        if (_not) {
            result.valid = false;
            result.message = "No such table";
            result.feature = SqliteModelPackage.Literals.CREATE_INDEX_STATEMENT__TABLE;
        }
    }
}
Also used : TableDefinition(com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)

Example 9 with TableDefinition

use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.

the class XSqliteModelScopeProvider method scope_InsertStatement_columnNames.

public IScope scope_InsertStatement_columnNames(final InsertStatement context, final EReference reference) {
    DDLStatement stmt = ModelUtil.<DDLStatement>getAncestorOfType(context, DDLStatement.class);
    TableDefinition _table = context.getTable();
    ArrayList<EObject> _findColumnDefs = ModelUtil.findColumnDefs(stmt, _table);
    return Scopes.scopeFor(_findColumnDefs, IScope.NULLSCOPE);
}
Also used : DDLStatement(com.robotoworks.mechanoid.db.sqliteModel.DDLStatement) EObject(org.eclipse.emf.ecore.EObject) TableDefinition(com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)

Example 10 with TableDefinition

use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.

the class XSqliteModelScopeProvider method scope_ColumnSourceRef_source.

public IScope scope_ColumnSourceRef_source(final UpdateStatement context, final EReference reference) {
    DDLStatement ddl = ModelUtil.<DDLStatement>getAncestorOfType(context, DDLStatement.class);
    TableDefinition _table = context.getTable();
    ArrayList<EObject> _findColumnDefs = ModelUtil.findColumnDefs(ddl, _table);
    return Scopes.scopeFor(_findColumnDefs, IScope.NULLSCOPE);
}
Also used : DDLStatement(com.robotoworks.mechanoid.db.sqliteModel.DDLStatement) EObject(org.eclipse.emf.ecore.EObject) TableDefinition(com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)

Aggregations

TableDefinition (com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)33 EObject (org.eclipse.emf.ecore.EObject)16 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)9 DDLStatement (com.robotoworks.mechanoid.db.sqliteModel.DDLStatement)7 SingleSourceTable (com.robotoworks.mechanoid.db.sqliteModel.SingleSourceTable)5 Function (com.google.common.base.Function)3 CreateViewStatement (com.robotoworks.mechanoid.db.sqliteModel.CreateViewStatement)3 HashMap (java.util.HashMap)3 QualifiedName (org.eclipse.xtext.naming.QualifiedName)3 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)3 AlterTableAddColumnStatement (com.robotoworks.mechanoid.db.sqliteModel.AlterTableAddColumnStatement)2 ColumnSource (com.robotoworks.mechanoid.db.sqliteModel.ColumnSource)2 CreateTableStatement (com.robotoworks.mechanoid.db.sqliteModel.CreateTableStatement)2 CreateTriggerStatement (com.robotoworks.mechanoid.db.sqliteModel.CreateTriggerStatement)2 Consumer (java.util.function.Consumer)2 AlterTableRenameStatement (com.robotoworks.mechanoid.db.sqliteModel.AlterTableRenameStatement)1 ColumnDef (com.robotoworks.mechanoid.db.sqliteModel.ColumnDef)1 ResultColumn (com.robotoworks.mechanoid.db.sqliteModel.ResultColumn)1 SelectCoreExpression (com.robotoworks.mechanoid.db.sqliteModel.SelectCoreExpression)1 SelectList (com.robotoworks.mechanoid.db.sqliteModel.SelectList)1