2018-08-07 17:57:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Interpreters/Context_fwd.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>
|
|
|
|
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <mutex>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
|
2018-08-07 17:57:44 +00:00
|
|
|
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-04-10 23:33:54 +00:00
|
|
|
class ODBCHandler : public HTTPRequestHandler, WithContext
|
2018-08-07 17:57:44 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-03-22 11:40:29 +00:00
|
|
|
ODBCHandler(
|
2021-04-10 23:33:54 +00:00
|
|
|
ContextPtr context_,
|
2020-04-28 00:56:44 +00:00
|
|
|
const String & mode_)
|
2021-04-10 23:33:54 +00:00
|
|
|
: WithContext(context_)
|
2024-01-23 17:04:50 +00:00
|
|
|
, log(getLogger("ODBCHandler"))
|
2020-04-28 00:56:44 +00:00
|
|
|
, mode(mode_)
|
2018-08-07 17:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-01-03 16:47:15 +00:00
|
|
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
2018-08-07 17:57:44 +00:00
|
|
|
|
|
|
|
private:
|
2024-01-23 17:04:50 +00:00
|
|
|
LoggerPtr log;
|
2018-08-09 12:57:34 +00:00
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|