mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
* fb-1940 re-implemented some changes that got missed private-public * fb-1939 fixes to between + decimals * fb-1935 - avg() on and id type + fixed some tests * fb-1953 add min/max for string types * fb-1938 - remove internal_type column from show columns * fb-1964 - fix space_used in fb_cluster_nodes to be int * fb-1996 - make sure all Idents that are being used as object references to schema objects are lowercased * fixed failing test * added some missed changes * fb-1969 found another case issue with identifier used for column idents
28 lines
970 B
Go
28 lines
970 B
Go
// Copyright 2021 Molecula Corp. All rights reserved.
|
|
|
|
package planner
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
|
|
"github.com/featurebasedb/featurebase/v3/dax"
|
|
"github.com/featurebasedb/featurebase/v3/sql3"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/parser"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/planner/types"
|
|
)
|
|
|
|
// compileDropDatabaseStatement compiles a DROP DATABASE statement into a
|
|
// PlanOperator.
|
|
func (p *ExecutionPlanner) compileDropDatabaseStatement(ctx context.Context, stmt *parser.DropDatabaseStatement) (_ types.PlanOperator, err error) {
|
|
databaseName := strings.ToLower(parser.IdentName(stmt.Name))
|
|
dbname := dax.DatabaseName(databaseName)
|
|
db, err := p.schemaAPI.DatabaseByName(ctx, dbname)
|
|
if err != nil {
|
|
if isDatabaseNotFoundError(err) {
|
|
return nil, sql3.NewErrDatabaseNotFound(stmt.Name.NamePos.Line, stmt.Name.NamePos.Column, databaseName)
|
|
}
|
|
return nil, err
|
|
}
|
|
return NewPlanOpQuery(p, NewPlanOpDropDatabase(p, db), p.sql), nil
|
|
}
|