Example #1
0
ODBCHandler::PoolPtr ODBCHandler::getPool(const std::string & connection_str)
{
    std::lock_guard lock(mutex);
    if (!pool_map->count(connection_str))
    {
        pool_map->emplace(connection_str, createAndCheckResizePocoSessionPool([connection_str]
        {
            return std::make_shared<Poco::Data::SessionPool>("ODBC", validateODBCConnectionString(connection_str));
        }));
    }
    return pool_map->at(connection_str);
}
Example #2
0
StorageODBC::StorageODBC(
    const std::string & name,
    const std::string & connection_string,
    const std::string & remote_database_name,
    const std::string & remote_table_name,
    const ColumnsDescription & columns_)
    : IStorage{columns_}
    , name(name)
    , remote_database_name(remote_database_name)
    , remote_table_name(remote_table_name)
{
    pool = createAndCheckResizePocoSessionPool([&]
    {
        return std::make_shared<Poco::Data::SessionPool>("ODBC", connection_string);
    });
}