forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostgreSQLHandlerFactory.cpp
More file actions
27 lines (23 loc) · 895 Bytes
/
Copy pathPostgreSQLHandlerFactory.cpp
File metadata and controls
27 lines (23 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "PostgreSQLHandlerFactory.h"
#include <Poco/Net/TCPServerConnectionFactory.h>
#include <memory>
#include <Server/PostgreSQLHandler.h>
namespace DB
{
PostgreSQLHandlerFactory::PostgreSQLHandlerFactory(IServer & server_)
: server(server_)
, log(&Poco::Logger::get("PostgreSQLHandlerFactory"))
{
auth_methods =
{
std::make_shared<PostgreSQLProtocol::PGAuthentication::NoPasswordAuth>(),
std::make_shared<PostgreSQLProtocol::PGAuthentication::CleartextPasswordAuth>(),
};
}
Poco::Net::TCPServerConnection * PostgreSQLHandlerFactory::createConnection(const Poco::Net::StreamSocket & socket)
{
Int32 connection_id = last_connection_id++;
LOG_TRACE(log, "PostgreSQL connection. Id: {}. Address: {}", connection_id, socket.peerAddress().toString());
return new PostgreSQLHandler(socket, server, ssl_enabled, connection_id, auth_methods);
}
}