MCPcopy Create free account
hub / github.com/ByConity/ByConity / nonInteractive

Method nonInteractive

programs/client/Client.cpp:904–944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902
903
904 void nonInteractive()
905 {
906 String text;
907
908 if (!queries_files.empty())
909 {
910 auto process_file = [&](const std::string & file) {
911 connection->setDefaultDatabase(connection_parameters.default_database);
912 ReadBufferFromFile in(file);
913 readStringUntilEOF(text, in);
914 return processMultiQuery(text);
915 };
916
917 for (const auto & queries_file : queries_files)
918 {
919 for (const auto & interleave_file : interleave_queries_files)
920 if (!process_file(interleave_file))
921 return;
922
923 if (!process_file(queries_file))
924 return;
925 }
926 return;
927 }
928 else if (config().has("query"))
929 {
930 text = config().getRawString("query"); /// Poco configuration should not process substitutions in form of ${...} inside query.
931 }
932 else
933 {
934 /// If 'query' parameter is not set, read a query from stdin.
935 /// The query is read entirely into memory (streaming is disabled).
936 ReadBufferFromFileDescriptor in(STDIN_FILENO);
937 readStringUntilEOF(text, in);
938 }
939
940 if (query_fuzzer_runs)
941 processWithFuzzing(text);
942 else
943 processQueryText(text);
944 }
945
946 bool processQueryText(const String & text)
947 {

Callers

nothing calls this directly

Calls 6

readStringUntilEOFFunction · 0.85
setDefaultDatabaseMethod · 0.80
getRawStringMethod · 0.80
configFunction · 0.50
emptyMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected