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

Method factory

grammar.cc:15–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13using namespace std;
14
15shared_ptr<table_ref> table_ref::factory(prod *p) {
16 try {
17 if (p->level < 3 + d6()) {
18 if (d6() > 3 && p->level < d6())
19 return make_shared<table_subquery>(p);
20 if (d6() > 3)
21 return make_shared<joined_table>(p);
22 }
23 if (d6() > 3)
24 return make_shared<table_or_query_name>(p);
25 else
26 return make_shared<table_sample>(p);
27 } catch (runtime_error &e) {
28 p->retry();
29 }
30 return factory(p);
31}
32
33table_or_query_name::table_or_query_name(prod *p) : table_ref(p) {
34 t = random_pick(scope->tables);

Callers

nothing calls this directly

Calls 2

d6Function · 0.85
retryMethod · 0.80

Tested by

no test coverage detected