Exemple #1
0
        // drop statement
        private void HandleStatement(DropStatement statement)
        {
            _catalogManager.CheckValidation(statement);
            SchemaRecord schema;

            switch (statement.TargetType)
            {
            case DropTarget.Table:
                schema = _catalogManager.GetTableSchemaRecord(statement.TableName);
                List <SchemaRecord> indices = _catalogManager.GetIndicesSchemaRecord(statement.TableName);
                // drop table
                _catalogManager.DropStatement(statement);
                _recordManager.DropTable(schema.RootPage);
                // drop index trees
                foreach (SchemaRecord index in indices)
                {
                    _recordManager.DropTable(index.RootPage);
                }
                break;

            case DropTarget.Index:
                schema = _catalogManager.GetIndexSchemaRecord(statement.IndexName);
                _catalogManager.DropStatement(statement);
                _recordManager.DropTable(schema.RootPage);
                break;
            }
        }