(stmt *ast.DropSchemaStmt)
| 114 | } |
| 115 | |
| 116 | func (c *Catalog) dropSchema(stmt *ast.DropSchemaStmt) error { |
| 117 | // TODO: n^2 in the worst-case |
| 118 | for _, name := range stmt.Schemas { |
| 119 | idx := -1 |
| 120 | for i := range c.Schemas { |
| 121 | if c.Schemas[i].Name == name.Str { |
| 122 | idx = i |
| 123 | } |
| 124 | } |
| 125 | if idx == -1 { |
| 126 | if stmt.MissingOk { |
| 127 | continue |
| 128 | } |
| 129 | return sqlerr.SchemaNotFound(name.Str) |
| 130 | } |
| 131 | c.Schemas = append(c.Schemas[:idx], c.Schemas[idx+1:]...) |
| 132 | } |
| 133 | return nil |
| 134 | } |
no test coverage detected