MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / PrintTableSchema

Function PrintTableSchema

src/cmd/sql_cmd.h:199–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void 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
223void PrintItems(std::ostream &stream, const std::string &head,
224 const std::vector<std::string> &items) {

Callers 1

HandleCmdFunction · 0.85

Calls 4

to_stringFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected