| 15 | using impedance::matched; |
| 16 | |
| 17 | shared_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 | |
| 42 | case_expr::case_expr(prod *p, sqltype *type_constraint) |
| 43 | : value_expr(p) |