| 197 | } |
| 198 | |
| 199 | void PrintTableSchema(std::ostream &stream, const ::hybridse::vm::Schema &schema) { |
| 200 | if (schema.empty()) { |
| 201 | stream << "Empty set" << std::endl; |
| 202 | return; |
| 203 | } |
| 204 | uint32_t items_size = schema.size(); |
| 205 | ::hybridse::base::TextTable t('-', ' ', ' '); |
| 206 | t.add("#"); |
| 207 | t.add("Field"); |
| 208 | t.add("Type"); |
| 209 | t.add("Null"); |
| 210 | t.end_of_row(); |
| 211 | |
| 212 | for (uint32_t i = 0; i < items_size; i++) { |
| 213 | auto column = schema.Get(i); |
| 214 | t.add(std::to_string(i + 1)); |
| 215 | t.add(column.name()); |
| 216 | t.add(::hybridse::type::Type_Name(column.type())); |
| 217 | t.add(column.is_not_null() ? "NO" : "YES"); |
| 218 | t.end_of_row(); |
| 219 | } |
| 220 | stream << t; |
| 221 | } |
| 222 | |
| 223 | void PrintItems(std::ostream &stream, const std::string &head, |
| 224 | const std::vector<std::string> &items) { |