ClickHouse/programs/odbc-bridge/MainHandler.h

47 lines
1.0 KiB
C++
Raw Normal View History

#pragma once
#include <Interpreters/Context_fwd.h>
#include <Server/HTTP/HTTPRequestHandler.h>
#include <Poco/Logger.h>
#include <mutex>
#include <unordered_map>
namespace DB
{
/** Main handler for requests to ODBC driver
* requires connection_string and columns in request params
* and also query in request body
* response in RowBinary format
*/
class ODBCHandler : public HTTPRequestHandler, WithContext
{
public:
2021-03-22 11:40:29 +00:00
ODBCHandler(
size_t keep_alive_timeout_,
ContextPtr context_,
2020-04-28 00:56:44 +00:00
const String & mode_)
: WithContext(context_)
2024-01-23 17:04:50 +00:00
, log(getLogger("ODBCHandler"))
, keep_alive_timeout(keep_alive_timeout_)
2020-04-28 00:56:44 +00:00
, mode(mode_)
{
}
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
private:
2024-01-23 17:04:50 +00:00
LoggerPtr log;
size_t keep_alive_timeout;
2020-04-28 00:56:44 +00:00
String mode;
static inline std::mutex mutex;
void processError(HTTPServerResponse & response, const std::string & message);
};
}