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

Function PrintProcedureSchema

src/cmd/sql_cmd.h:271–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271void PrintProcedureSchema(const std::string& head,
272 const ::hybridse::sdk::Schema &sdk_schema, std::ostream &stream) {
273 try {
274 const ::hybridse::sdk::SchemaImpl& schema_impl = dynamic_cast<const ::hybridse::sdk::SchemaImpl&>(sdk_schema);
275 auto& schema = schema_impl.GetSchema();
276 if (schema.empty()) {
277 stream << "Empty set" << std::endl;
278 return;
279 }
280 uint32_t items_size = schema.size();
281 ::hybridse::base::TextTable t('-', ' ', ' ');
282
283 t.add("#");
284 t.add("Field");
285 t.add("Type");
286 t.add("IsConstant");
287 t.end_of_row();
288
289 for (uint32_t i = 0; i < items_size; i++) {
290 auto column = schema.Get(i);
291 t.add(std::to_string(i + 1));
292 t.add(column.name());
293 t.add(::hybridse::type::Type_Name(column.type()));
294 t.add(column.is_constant() ? "YES" : "NO");
295 t.end_of_row();
296 }
297 stream << t << std::endl;
298 } catch(std::bad_cast) {
299 return;
300 }
301}
302
303void PrintProcedureInfo(const hybridse::sdk::ProcedureInfo& sp_info) {
304 std::vector<std::pair<std::string, std::string>> vec;

Callers 1

PrintProcedureInfoFunction · 0.85

Calls 5

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

Tested by

no test coverage detected