MCPcopy Create free account
hub / github.com/anse1/sqlsmith / common_table_expression

Method common_table_expression

grammar.cc:498–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498common_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
527void common_table_expression::out(std::ostream &out)
528{

Callers

nothing calls this directly

Calls 4

d6Function · 0.85
random_pickFunction · 0.85
stmt_uidMethod · 0.80
retryFunction · 0.70

Tested by

no test coverage detected