func (dvs *DropView) String() string {
	childrenStrings := make([]string, len(dvs.children))
	for i, child := range dvs.children {
		childrenStrings[i] = child.String()
	}
	pr := sql.NewTreePrinter()
	_ = pr.WriteNode("DropView")
	_ = pr.WriteChildren(childrenStrings...)
	return pr.String()
}
String implements the fmt.Stringer interface, using sql.TreePrinter to
generate the string.
package plan
import (
	errors "gopkg.in/src-d/go-errors.v1"
	"github.com/dolthub/go-mysql-server/sql"
)
var errDropViewChild = errors.NewKind("any child of DropView must be of type SingleDropView")
type SingleDropView struct {
	database sql.Database
	viewName string
}
func NewSingleDropView(
	database sql.Database,
	viewName string,
) *SingleDropView {
	return &SingleDropView{database, viewName}
}
func (dv *SingleDropView) Children() []sql.Node {
	return nil
}
func (dv *SingleDropView) Resolved() bool {
	_, ok := dv.database.(sql.UnresolvedDatabase)
	return !ok
}
func (dv *SingleDropView) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error) {
	return sql.RowsToRowIter(), nil
}
func (dv *SingleDropView) Schema() sql.Schema { return nil }
func (dv *SingleDropView) String() string {
	pr := sql.NewTreePrinter()
	_ = pr.WriteNode("SingleDropView(%s.%s)", dv.database.Name(), dv.viewName)
	return pr.String()
}
func (dv *SingleDropView) WithChildren(children ...sql.Node) (sql.Node, error) {
	if len(children) != 0 {
		return nil, sql.ErrInvalidChildrenNumber.New(dv, len(children), 0)
	}
	return dv, nil
}
func (dv *SingleDropView) Database() sql.Database {
	return dv.database
}
func (dv *SingleDropView) WithDatabase(database sql.Database) (sql.Node, error) {
	newDrop := *dv
	newDrop.database = database
	return &newDrop, nil
}
type DropView struct {
	children []sql.Node
	ifExists bool
}
func NewDropView(children []sql.Node, ifExists bool) *DropView {
	return &DropView{children: children, ifExists: ifExists}
}
func (dvs *DropView) Children() []sql.Node {
	return dvs.children
}
func (dvs *DropView) Resolved() bool {
	for _, child := range dvs.children {
		if !child.Resolved() {
			return false
		}
	}
	return true
}
func (dvs *DropView) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error) {
	for _, child := range dvs.children {
		drop, ok := child.(*SingleDropView)
		if !ok {
			return sql.RowsToRowIter(), errDropViewChild.New()
		}
		if dropper, ok := drop.database.(sql.ViewDatabase); ok {
			err := dropper.DropView(ctx, drop.viewName)
			if err != nil {
				allowedError := dvs.ifExists && sql.ErrViewDoesNotExist.Is(err)
				if !allowedError {
					return sql.RowsToRowIter(), err
				}
			}
		} else {
			err := ctx.GetViewRegistry().Delete(drop.database.Name(), drop.viewName)
			allowedError := dvs.ifExists && sql.ErrViewDoesNotExist.Is(err)
			if !allowedError {
				return sql.RowsToRowIter(), err
			}
		}
	}
	return sql.RowsToRowIter(), nil
}
func (dvs *DropView) Schema() sql.Schema { return nil }