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

Method factory

expr.cc:17–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using impedance::matched;
16
17shared_ptr<value_expr> value_expr::factory(prod *p, sqltype *type_constraint)
18{
19 try {
20 if (1 == d20() && p->level < d6() && window_function::allowed(p))
21 return make_shared<window_function>(p, type_constraint);
22 else if (1 == d42() && p->level < d6())
23 return make_shared<coalesce>(p, type_constraint);
24 else if (1 == d42() && p->level < d6())
25 return make_shared<nullif>(p, type_constraint);
26 else if (p->level < d6() && d6() == 1)
27 return make_shared<funcall>(p, type_constraint);
28 else if (d12()==1)
29 return make_shared<atomic_subselect>(p, type_constraint);
30 else if (p->level< d6() && d9()==1)
31 return make_shared<case_expr>(p, type_constraint);
32 else if (p->scope->refs.size() && d20() > 1)
33 return make_shared<column_reference>(p, type_constraint);
34 else
35 return make_shared<const_expr>(p, type_constraint);
36 } catch (runtime_error &e) {
37 }
38 p->retry();
39 return factory(p, type_constraint);
40}
41
42case_expr::case_expr(prod *p, sqltype *type_constraint)
43 : value_expr(p)

Callers

nothing calls this directly

Calls 7

d20Function · 0.85
d6Function · 0.85
d42Function · 0.85
d12Function · 0.85
d9Function · 0.85
d100Function · 0.85
retryMethod · 0.80

Tested by

no test coverage detected