Ejemplo n.º 1
0
        // delete statement
        // NOTICE: relative index trees will NOT change accordingly
        private void HandleStatement(DeleteStatement statement)
        {
            // get table and indices
            _catalogManager.CheckValidation(statement);
            SchemaRecord        tableSchema  = _catalogManager.GetTableSchemaRecord(statement.TableName);
            List <SchemaRecord> indexSchemas = _catalogManager.GetIndicesSchemaRecord(statement.TableName);

            // TODO
            // delete index records from index trees
            // __problem__:
            // attribute names := (priKey, a, b, c)
            // condition := b < 3 and c > 5
            // fun facts: b and c both have index trees
            // issue: to delete the records satisfying the condition above

            // delete record from table tree
            int newTableRootPage = _recordManager.DeleteRecords(statement.Condition, tableSchema.SQL.PrimaryKey, tableSchema.SQL.AttributeDeclarations, tableSchema.RootPage);

            _catalogManager.TryUpdateSchemaRecord(statement.TableName, newTableRootPage);
        }