| 255 | } |
| 256 | |
| 257 | int main(int argc, char **argv) { |
| 258 | pax::tools::DumpConfig config; |
| 259 | int rc = 0; |
| 260 | |
| 261 | progname = argv[0]; |
| 262 | InitConfig(&config, argc, argv); |
| 263 | |
| 264 | pax::tools::OrcDumpReader reader(&config); |
| 265 | try { |
| 266 | bool ok = reader.Open(); |
| 267 | if (!ok) { |
| 268 | std::cout << "Failed to dump current file: " << config.file_name |
| 269 | << ", Toast file: " << config.toast_file_name // safe |
| 270 | << std::endl; |
| 271 | rc = -1; |
| 272 | goto finish; |
| 273 | } |
| 274 | |
| 275 | std::cout << reader.Dump() << std::endl; |
| 276 | } catch (cbdb::CException &e) { |
| 277 | std::cout << "error happend while dumping.\n " << e.What() << std::endl; |
| 278 | std::cout << "Stack: \n" << e.Stack() << std::endl; |
| 279 | rc = -1; |
| 280 | goto finish; |
| 281 | } |
| 282 | |
| 283 | finish: |
| 284 | free(config.file_name); |
| 285 | free(config.toast_file_name); |
| 286 | reader.Close(); |
| 287 | return rc; |
| 288 | } |