@@ -306,8 +306,6 @@ ASTPtr ClientBase::parseQuery(const char *& pos, const char * end, bool allow_mu
306306 const auto & settings = global_context->getSettingsRef ();
307307 size_t max_length = 0 ;
308308
309- auto begin = pos;
310-
311309 if (!allow_multi_statements)
312310 max_length = settings.max_query_size ;
313311
@@ -336,14 +334,8 @@ ASTPtr ClientBase::parseQuery(const char *& pos, const char * end, bool allow_mu
336334
337335 if (!res)
338336 {
339- if (sql_dialect != " kusto" )
340- res = tryParseQuery (kql_parser, begin, end, message, true , " " , allow_multi_statements, max_length, settings.max_parser_depth );
341-
342- if (!res)
343- {
344- std::cerr << std::endl << message << std::endl << std::endl;
345- return nullptr ;
346- }
337+ std::cerr << std::endl << message << std::endl << std::endl;
338+ return nullptr ;
347339 }
348340 }
349341 else
@@ -1895,21 +1887,9 @@ bool ClientBase::executeMultiQuery(const String & all_queries_text)
18951887
18961888bool ClientBase::processQueryText (const String & text)
18971889{
1898- auto trimmed_input = trim (text, [](char c) { return isWhitespaceASCII (c) || c == ' ;' ; });
1899-
1900- if (exit_strings.end () != exit_strings.find (trimmed_input))
1890+ if (exit_strings.end () != exit_strings.find (trim (text, [](char c) { return isWhitespaceASCII (c) || c == ' ;' ; })))
19011891 return false ;
19021892
1903- if (trimmed_input.starts_with (" \\ i" ))
1904- {
1905- size_t skip_prefix_size = std::strlen (" \\ i" );
1906- auto file_name = trim (
1907- trimmed_input.substr (skip_prefix_size, trimmed_input.size () - skip_prefix_size),
1908- [](char c) { return isWhitespaceASCII (c); });
1909-
1910- return processMultiQueryFromFile (file_name);
1911- }
1912-
19131893 if (!is_multiquery)
19141894 {
19151895 assert (!query_fuzzer_runs);
@@ -2092,31 +2072,30 @@ void ClientBase::runInteractive()
20922072}
20932073
20942074
2095- bool ClientBase::processMultiQueryFromFile (const String & file_name)
2096- {
2097- String queries_from_file;
2098-
2099- ReadBufferFromFile in (file_name);
2100- readStringUntilEOF (queries_from_file, in);
2101-
2102- return executeMultiQuery (queries_from_file);
2103- }
2104-
2105-
21062075void ClientBase::runNonInteractive ()
21072076{
21082077 if (delayed_interactive)
21092078 initQueryIdFormats ();
21102079
21112080 if (!queries_files.empty ())
21122081 {
2082+ auto process_multi_query_from_file = [&](const String & file)
2083+ {
2084+ String queries_from_file;
2085+
2086+ ReadBufferFromFile in (file);
2087+ readStringUntilEOF (queries_from_file, in);
2088+
2089+ return executeMultiQuery (queries_from_file);
2090+ };
2091+
21132092 for (const auto & queries_file : queries_files)
21142093 {
21152094 for (const auto & interleave_file : interleave_queries_files)
2116- if (!processMultiQueryFromFile (interleave_file))
2095+ if (!process_multi_query_from_file (interleave_file))
21172096 return ;
21182097
2119- if (!processMultiQueryFromFile (queries_file))
2098+ if (!process_multi_query_from_file (queries_file))
21202099 return ;
21212100 }
21222101
0 commit comments