cloudflare/ClickHouse
Publicmirrored fromhttps://github.com/cloudflare/ClickHouse
programs/odbc-bridge/ColumnInfoHandler.h
35lines · modecode
unknown
| 1 | #pragma once |
| 2 | |
| 3 | #if USE_ODBC |
| 4 | |
| 5 | # include <Interpreters/Context.h> |
| 6 | # include <Poco/Logger.h> |
| 7 | # include <Poco/Net/HTTPRequestHandler.h> |
| 8 | # include <Common/config.h> |
| 9 | |
| 10 | /** The structure of the table is taken from the query "SELECT * FROM table WHERE 1=0". |
| 11 | * TODO: It would be much better to utilize ODBC methods dedicated for columns description. |
| 12 | * If there is no such table, an exception is thrown. |
| 13 | */ |
| 14 | namespace DB |
| 15 | { |
| 16 | |
| 17 | class ODBCColumnsInfoHandler : public Poco::Net::HTTPRequestHandler |
| 18 | { |
| 19 | public: |
| 20 | ODBCColumnsInfoHandler(size_t keep_alive_timeout_, Context & context_) |
| 21 | : log(&Poco::Logger::get("ODBCColumnsInfoHandler")), keep_alive_timeout(keep_alive_timeout_), context(context_) |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | void handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) override; |
| 26 | |
| 27 | private: |
| 28 | Poco::Logger * log; |
| 29 | size_t keep_alive_timeout; |
| 30 | Context & context; |
| 31 | }; |
| 32 | |
| 33 | } |
| 34 | |
| 35 | #endif |