Execute processes `EXPLAIN` statement for queries and DMLs.
(ctx context.Context, session *Session)
| 541 | |
| 542 | // Execute processes `EXPLAIN` statement for queries and DMLs. |
| 543 | func (s *ExplainStatement) Execute(ctx context.Context, session *Session) (*Result, error) { |
| 544 | queryPlan, timestamp, _, err := runAnalyzeQuery(ctx, session, spanner.NewStatement(s.Explain), s.IsDML) |
| 545 | if err != nil { |
| 546 | return nil, err |
| 547 | } |
| 548 | |
| 549 | if queryPlan == nil { |
| 550 | return nil, errors.New("EXPLAIN statement is not supported for Cloud Spanner Emulator.") |
| 551 | } |
| 552 | |
| 553 | rows, predicates, err := processPlanWithoutStats(queryPlan) |
| 554 | if err != nil { |
| 555 | return nil, err |
| 556 | } |
| 557 | |
| 558 | result := &Result{ |
| 559 | ColumnNames: explainColumnNames, |
| 560 | AffectedRows: len(rows), |
| 561 | Rows: rows, |
| 562 | Timestamp: timestamp, |
| 563 | Predicates: predicates, |
| 564 | } |
| 565 | |
| 566 | return result, nil |
| 567 | } |
| 568 | |
| 569 | type DescribeStatement struct { |
| 570 | Statement string |
nothing calls this directly
no test coverage detected