| 434 | } |
| 435 | |
| 436 | ResultSet *ExecutionPlan_Execute(ExecutionPlan *plan) { |
| 437 | ASSERT(plan->prepared) |
| 438 | // Set an exception-handling breakpoint to capture run-time errors. |
| 439 | // encountered_error will be set to 0 when setjmp is invoked, and will be nonzero if |
| 440 | // a downstream exception returns us to this breakpoint |
| 441 | int encountered_error = SET_EXCEPTION_HANDLER(); |
| 442 | |
| 443 | // Encountered a run-time error - return immediately. |
| 444 | if(encountered_error) return QueryCtx_GetResultSet(); |
| 445 | |
| 446 | ExecutionPlan_Init(plan); |
| 447 | |
| 448 | Record r = NULL; |
| 449 | // Execute the root operation and free the processed Record until the data stream is depleted. |
| 450 | while((r = OpBase_Consume(plan->root)) != NULL) ExecutionPlan_ReturnRecord(r->owner, r); |
| 451 | |
| 452 | return QueryCtx_GetResultSet(); |
| 453 | } |
| 454 | |
| 455 | //------------------------------------------------------------------------------ |
| 456 | // Execution plan draining |
no test coverage detected