| 60 | } |
| 61 | |
| 62 | TableFunctionPtr TableFunctionFactory::tryGet( |
| 63 | const std::string & name_param, |
| 64 | ContextPtr) const |
| 65 | { |
| 66 | String name = getAliasToOrName(name_param); |
| 67 | TableFunctionPtr res; |
| 68 | |
| 69 | auto it = table_functions.find(name); |
| 70 | if (table_functions.end() != it) |
| 71 | { |
| 72 | res = it->second.creator(); |
| 73 | } |
| 74 | else |
| 75 | { |
| 76 | it = case_insensitive_table_functions.find(Poco::toLower(name)); |
| 77 | if (case_insensitive_table_functions.end() != it) |
| 78 | res = it->second.creator(); |
| 79 | } |
| 80 | |
| 81 | if (!res) |
| 82 | return nullptr; |
| 83 | |
| 84 | if (CurrentThread::isInitialized()) |
| 85 | { |
| 86 | auto query_context = CurrentThread::get().tryGetQueryContext(); |
| 87 | if (query_context && query_context->getSettingsRef()[Setting::log_queries]) |
| 88 | query_context->addQueryFactoriesInfo(Context::QueryLogFactories::TableFunction, name); |
| 89 | } |
| 90 | |
| 91 | return res; |
| 92 | } |
| 93 | |
| 94 | bool TableFunctionFactory::isTableFunctionName(const std::string & name) const |
| 95 | { |
no test coverage detected