| 60 | } |
| 61 | |
| 62 | void printTableRefInfo(std::ostream& s, TableRef* table, uintmax_t numIndent) |
| 63 | { |
| 64 | switch (table->type) { |
| 65 | case kTableName: |
| 66 | inprint(s, table->name, numIndent); |
| 67 | if (table->schema) { |
| 68 | inprint(s, "Schema", numIndent + 1); |
| 69 | inprint(s, table->schema, numIndent + 2); |
| 70 | } |
| 71 | break; |
| 72 | case kTableSelect: |
| 73 | printSelectStatementInfo(s, table->select, numIndent); |
| 74 | break; |
| 75 | case kTableJoin: |
| 76 | inprint(s, "Join Table", numIndent); |
| 77 | inprint(s, "Left", numIndent + 1); |
| 78 | printTableRefInfo(s, table->join->left, numIndent + 2); |
| 79 | inprint(s, "Right", numIndent + 1); |
| 80 | printTableRefInfo(s, table->join->right, numIndent + 2); |
| 81 | inprint(s, "Join Condition", numIndent + 1); |
| 82 | printExpression(s, table->join->condition, numIndent + 2); |
| 83 | break; |
| 84 | case kTableCrossProduct: |
| 85 | for (TableRef* tbl : *table->list) { |
| 86 | printTableRefInfo(s, tbl, numIndent); |
| 87 | } |
| 88 | break; |
| 89 | } |
| 90 | |
| 91 | if (table->alias) { |
| 92 | printAlias(s, table->alias, numIndent); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void printAlias(std::ostream& s, Alias* alias, uintmax_t numIndent) |
| 97 | { |
no test coverage detected