| 160 | |
| 161 | |
| 162 | static void tryFindInputFunctionImpl(const ASTPtr & ast, ASTPtr & input_function) |
| 163 | { |
| 164 | if (!ast) |
| 165 | return; |
| 166 | for (const auto & child : ast->children) |
| 167 | tryFindInputFunctionImpl(child, input_function); |
| 168 | |
| 169 | if (const auto * table_function_ast = ast->as<ASTFunction>()) |
| 170 | { |
| 171 | if (table_function_ast->name == "input") |
| 172 | { |
| 173 | if (input_function) |
| 174 | throw Exception(ErrorCodes::INVALID_USAGE_OF_INPUT, "You can use the `input` function only once in a query."); |
| 175 | input_function = ast; |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | |
| 181 | void ASTInsertQuery::tryFindInputFunction(ASTPtr & input_function) const |
no test coverage detected