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

Method simple_join_cond

grammar.cc:109–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109simple_join_cond::simple_join_cond(prod *p, table_ref &lhs, table_ref &rhs)
110 : join_cond(p, lhs, rhs)
111{
112retry:
113 named_relation *left_rel = &*random_pick(lhs.refs);
114
115 if (!left_rel->columns().size())
116 { retry(); goto retry; }
117
118 named_relation *right_rel = &*random_pick(rhs.refs);
119
120 column &c1 = random_pick(left_rel->columns());
121
122 for (auto c2 : right_rel->columns()) {
123 if (c1.type == c2.type) {
124 condition +=
125 left_rel->ident() + "." + c1.name + " = " + right_rel->ident() + "." + c2.name + " ";
126 break;
127 }
128 }
129 if (condition == "") {
130 retry(); goto retry;
131 }
132}
133
134void simple_join_cond::out(std::ostream &out) {
135 out << condition;

Callers

nothing calls this directly

Calls 3

random_pickFunction · 0.85
retryFunction · 0.70
identMethod · 0.45

Tested by

no test coverage detected