| 107 | } |
| 108 | |
| 109 | simple_join_cond::simple_join_cond(prod *p, table_ref &lhs, table_ref &rhs) |
| 110 | : join_cond(p, lhs, rhs) |
| 111 | { |
| 112 | retry: |
| 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 | |
| 134 | void simple_join_cond::out(std::ostream &out) { |
| 135 | out << condition; |
nothing calls this directly
no test coverage detected