equal
deleted
inserted
replaced
57 std::shared_ptr<writer::RelationalWriter> writer(writer::Factory::create(std::cout)); |
57 std::shared_ptr<writer::RelationalWriter> writer(writer::Factory::create(std::cout)); |
58 |
58 |
59 if (configuration.listDataSources) { |
59 if (configuration.listDataSources) { |
60 // --list-data-sources: |
60 // --list-data-sources: |
61 SqlHandler::listDataSources(writer.get(), driverManager.get()); |
61 SqlHandler::listDataSources(writer.get(), driverManager.get()); |
62 } else if (std::regex_match(cli.programName(), std::wregex(L"^(.*/)?relpipe-in-sql$"))) { |
62 if (isatty(fileno(stdin)) && configuration.statements.empty() && configuration.copyRelations.empty()) goto end; |
|
63 } |
|
64 |
|
65 if (std::regex_match(cli.programName(), std::wregex(L"^(.*/)?relpipe-in-sql$"))) { |
63 // relpipe-in-sql: |
66 // relpipe-in-sql: |
64 if (cli.arguments().size() == 0) configuration.copyRelations.push_back({L".*", L"", false}); |
67 if (cli.arguments().size() == 0) configuration.copyRelations.push_back({L".*", L"", false}); |
65 configuration.sqlBeforeRelational = isatty(fileno(stdin)) ? nullptr : &std::wcin; |
68 configuration.sqlBeforeRelational = isatty(fileno(stdin)) ? nullptr : &std::wcin; |
66 configuration.sqlAfterRelational = nullptr; |
69 configuration.sqlAfterRelational = nullptr; |
67 SqlHandler handler(writer.get(), driverManager.get(), configuration); |
70 SqlHandler handler(writer.get(), driverManager.get(), configuration); |
72 SqlHandler handler(writer.get(), driverManager.get(), configuration); |
75 SqlHandler handler(writer.get(), driverManager.get(), configuration); |
73 reader->addHandler(&handler); |
76 reader->addHandler(&handler); |
74 reader->process(); |
77 reader->process(); |
75 } |
78 } |
76 |
79 |
|
80 end: |
77 resultCode = CLI::EXIT_CODE_SUCCESS; |
81 resultCode = CLI::EXIT_CODE_SUCCESS; |
78 |
82 |
79 } catch (RelpipeCLIException& e) { |
83 } catch (RelpipeCLIException& e) { |
80 fwprintf(stderr, L"Caught CLI exception: %ls\n", e.getMessge().c_str()); |
84 fwprintf(stderr, L"Caught CLI exception: %ls\n", e.getMessge().c_str()); |
81 fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); |
85 fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); |