BuildRowIter implements the interface sql.ExecBuilderNode.
(ctx *sql.Context, b sql.NodeExecBuilder, r sql.Row)
| 55 | |
| 56 | // BuildRowIter implements the interface sql.ExecBuilderNode. |
| 57 | func (c *DropTable) BuildRowIter(ctx *sql.Context, b sql.NodeExecBuilder, r sql.Row) (sql.RowIter, error) { |
| 58 | dropTableIter, err := b.Build(ctx, c.gmsDropTable, r) |
| 59 | if err != nil { |
| 60 | return nil, err |
| 61 | } |
| 62 | |
| 63 | for _, table := range c.gmsDropTable.Tables { |
| 64 | var dbName string |
| 65 | var schemaName string |
| 66 | var tableName string |
| 67 | switch table := table.(type) { |
| 68 | case *plan.ResolvedTable: |
| 69 | schemaName, err = core.GetSchemaName(ctx, table.Database(), "") |
| 70 | if err != nil { |
| 71 | return nil, err |
| 72 | } |
| 73 | tableName = table.Name() |
| 74 | dbName = table.Database().Name() |
| 75 | default: |
| 76 | return nil, errors.Errorf("encountered unexpected table type `%T` during DROP TABLE", table) |
| 77 | } |
| 78 | |
| 79 | tableID := id.NewTable(schemaName, tableName).AsId() |
| 80 | if err = id.ValidateOperation(ctx, id.Section_Table, id.Operation_Delete, dbName, tableID, id.Null); err != nil { |
| 81 | return nil, err |
| 82 | } |
| 83 | if err = id.PerformOperation(ctx, id.Section_Table, id.Operation_Delete, dbName, tableID, id.Null); err != nil { |
| 84 | return nil, err |
| 85 | } |
| 86 | } |
| 87 | return dropTableIter, err |
| 88 | } |
| 89 | |
| 90 | // Schema implements the interface sql.ExecBuilderNode. |
| 91 | func (c *DropTable) Schema(ctx *sql.Context) sql.Schema { |
nothing calls this directly
no test coverage detected