| 4476 | } |
| 4477 | |
| 4478 | void HandleClientShowSchema(const std::vector<std::string>& parts, |
| 4479 | ::fedb::client::TabletClient* client) { |
| 4480 | if (parts.size() < 3) { |
| 4481 | std::cout << "Bad show schema format" << std::endl; |
| 4482 | return; |
| 4483 | } |
| 4484 | ::fedb::api::TableMeta table_meta; |
| 4485 | try { |
| 4486 | bool ok = client->GetTableSchema( |
| 4487 | boost::lexical_cast<uint32_t>(parts[1]), |
| 4488 | boost::lexical_cast<uint32_t>(parts[2]), table_meta); |
| 4489 | if (!ok) { |
| 4490 | std::cout << "ShowSchema failed" << std::endl; |
| 4491 | return; |
| 4492 | } |
| 4493 | } catch (std::exception const& e) { |
| 4494 | std::cout << "Invalid args" << std::endl; |
| 4495 | return; |
| 4496 | } |
| 4497 | if (table_meta.column_desc_size() > 0) { |
| 4498 | ::fedb::cmd::PrintSchema(table_meta.column_desc(), table_meta.added_column_desc()); |
| 4499 | printf("\n#ColumnKey\n"); |
| 4500 | ::fedb::cmd::PrintColumnKey(table_meta.column_key()); |
| 4501 | } else { |
| 4502 | std::cout << "No schema for table" << std::endl; |
| 4503 | } |
| 4504 | } |
| 4505 | |
| 4506 | void HandleClientSGet(const std::vector<std::string>& parts, |
| 4507 | ::fedb::client::TabletClient* client) { |
no test coverage detected