2018-08-07 17:57:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/Context.h>
|
2021-02-19 12:51:26 +00:00
|
|
|
#include <Server/HTTP/HTTPRequestHandler.h>
|
2018-08-07 17:57:44 +00:00
|
|
|
#include <Poco/Logger.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2018-08-10 14:46:12 +00:00
|
|
|
/** 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
|
|
|
|
*/
|
2021-02-19 12:51:26 +00:00
|
|
|
class ODBCHandler : public HTTPRequestHandler
|
2018-08-07 17:57:44 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-03-22 11:40:29 +00:00
|
|
|
ODBCHandler(
|
2018-08-07 17:57:44 +00:00
|
|
|
size_t keep_alive_timeout_,
|
2020-05-13 18:30:26 +00:00
|
|
|
Context & context_,
|
2020-04-28 00:56:44 +00:00
|
|
|
const String & mode_)
|
2018-08-08 16:15:29 +00:00
|
|
|
: log(&Poco::Logger::get("ODBCHandler"))
|
2018-08-07 17:57:44 +00:00
|
|
|
, keep_alive_timeout(keep_alive_timeout_)
|
|
|
|
, context(context_)
|
2020-04-28 00:56:44 +00:00
|
|
|
, mode(mode_)
|
2018-08-07 17:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-02-19 12:51:26 +00:00
|
|
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response) override;
|
2018-08-07 17:57:44 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Poco::Logger * log;
|
2018-08-09 12:57:34 +00:00
|
|
|
|
2018-08-07 17:57:44 +00:00
|
|
|
size_t keep_alive_timeout;
|
2020-04-17 14:40:39 +00:00
|
|
|
Context & context;
|
2020-04-28 00:56:44 +00:00
|
|
|
String mode;
|
2018-08-09 12:57:34 +00:00
|
|
|
|
|
|
|
static inline std::mutex mutex;
|
|
|
|
|
2021-02-19 12:51:26 +00:00
|
|
|
void processError(HTTPServerResponse & response, const std::string & message);
|
2018-08-07 17:57:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|