| 496 | } |
| 497 | |
| 498 | common_table_expression::common_table_expression(prod *parent, struct scope *s) |
| 499 | : prod(parent), myscope(s) |
| 500 | { |
| 501 | scope = &myscope; |
| 502 | do { |
| 503 | shared_ptr<query_spec> query = make_shared<query_spec>(this, s); |
| 504 | with_queries.push_back(query); |
| 505 | string alias = scope->stmt_uid("jennifer"); |
| 506 | auto *relation = &query->select_list->derived_table; |
| 507 | auto aliased_rel = make_shared<aliased_relation>(alias, relation); |
| 508 | refs.push_back(aliased_rel); |
| 509 | scope->tables.push_back(&*aliased_rel); |
| 510 | |
| 511 | } while (d6() > 2); |
| 512 | |
| 513 | retry: |
| 514 | do { |
| 515 | auto pick = random_pick(s->tables); |
| 516 | scope->tables.push_back(pick); |
| 517 | } while (d6() > 3); |
| 518 | try { |
| 519 | query = make_shared<query_spec>(this, scope); |
| 520 | } catch (runtime_error &e) { |
| 521 | retry(); |
| 522 | goto retry; |
| 523 | } |
| 524 | |
| 525 | } |
| 526 | |
| 527 | void common_table_expression::out(std::ostream &out) |
| 528 | { |
nothing calls this directly
no test coverage detected