ClickHouse

Форк
0
40 строк · 1.1 Кб
1
#include "Utils.h"
2

3
#if USE_LIBPQXX
4

5
#include <IO/Operators.h>
6
#include <IO/WriteHelpers.h>
7

8
namespace postgres
9
{
10

11
ConnectionInfo formatConnectionString(String dbname, String host, UInt16 port, String user, String password)
12
{
13
    DB::WriteBufferFromOwnString out;
14
    out << "dbname=" << DB::quote << dbname
15
        << " host=" << DB::quote << host
16
        << " port=" << port
17
        << " user=" << DB::quote << user
18
        << " password=" << DB::quote << password
19
        << " connect_timeout=2";
20
    return {out.str(), host + ':' + DB::toString(port)};
21
}
22

23
String getConnectionForLog(const String & host, UInt16 port)
24
{
25
    return host + ":" + DB::toString(port);
26
}
27

28
String formatNameForLogs(const String & postgres_database_name, const String & postgres_table_name)
29
{
30
    /// Logger for StorageMaterializedPostgreSQL - both db and table names.
31
    /// Logger for PostgreSQLReplicationHandler and Consumer - either both db and table names or only db name.
32
    assert(!postgres_database_name.empty());
33
    if (postgres_table_name.empty())
34
        return postgres_database_name;
35
    return postgres_database_name + '.' + postgres_table_name;
36
}
37

38
}
39

40
#endif
41

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.