| 71 | |
| 72 | |
| 73 | void TableFunctionSQLite::parseArguments(const ASTPtr & ast_function, ContextPtr context) |
| 74 | { |
| 75 | const auto & func_args = ast_function->as<ASTFunction &>(); |
| 76 | |
| 77 | if (!func_args.arguments) |
| 78 | throw Exception(ErrorCodes::BAD_ARGUMENTS, "Table function 'sqlite' must have arguments."); |
| 79 | |
| 80 | ASTs & args = func_args.arguments->children; |
| 81 | |
| 82 | if (args.size() != 2) |
| 83 | throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "SQLite database requires 2 arguments: database path, table name"); |
| 84 | |
| 85 | for (auto & arg : args) |
| 86 | arg = evaluateConstantExpressionOrIdentifierAsLiteral(arg, context); |
| 87 | |
| 88 | database_path = checkAndGetLiteralArgument<String>(args[0], "database_path"); |
| 89 | remote_table_name = checkAndGetLiteralArgument<String>(args[1], "table_name"); |
| 90 | |
| 91 | sqlite_db = openSQLiteDB(database_path, context); |
| 92 | } |
| 93 | |
| 94 | } |
| 95 |
nothing calls this directly
no test coverage detected