| 1943 | } |
| 1944 | |
| 1945 | BlockIO |
| 1946 | executeQuery(const String & query, ContextMutablePtr context, bool internal, QueryProcessingStage::Enum stage, bool may_have_embedded_data) |
| 1947 | { |
| 1948 | ASTPtr ast; |
| 1949 | BlockIO streams; |
| 1950 | |
| 1951 | |
| 1952 | std::tie(ast, streams) |
| 1953 | = executeQueryImpl(query.data(), query.data() + query.size(), nullptr, context, internal, stage, !may_have_embedded_data, nullptr); |
| 1954 | |
| 1955 | if (const auto * ast_query_with_output = dynamic_cast<const ASTQueryWithOutput *>(ast.get())) |
| 1956 | { |
| 1957 | |
| 1958 | // Try to redirect streams to the target file instead of the client when outfile_in_server_with_tcp is true |
| 1959 | tryOutfile(streams, ast, context); |
| 1960 | |
| 1961 | String format_name = ast_query_with_output->format ? getIdentifierName(ast_query_with_output->format) : context->getDefaultFormat(); |
| 1962 | |
| 1963 | if (format_name == "Null") |
| 1964 | streams.null_format = true; |
| 1965 | } |
| 1966 | |
| 1967 | return streams; |
| 1968 | } |
| 1969 | |
| 1970 | BlockIO executeQuery( |
| 1971 | const String & query, |