#include #include #include "pgxx/pgxx.hpp" auto main(int argc, char* args[]) -> int { const std::string con = "postgres://chatlanin:password_for_connection_to_test_db@localhost:5423/test.db?sslmode=disable"; try { PGXX().init("con_1", 300, con); PGXX().init("con_2", 300, con); } catch(hack::exception& ex) { ex.log(); throw; } if (!PGXX().ready()) hack::log()("error connection"); pgxx::JSON j { { "params", { { "key_1", 1 }, { "key2", "value" } } } }; for (auto i = 0; i < 10; ++i) { std::thread th([&j](){ auto r = PGXX().execute("con_1", "read_and_write", j); }); th.detach(); } for (auto i = 0; i < 10; ++i) { auto r = PGXX().execute("con_2", "read_and_write", j); } hack::log()("ok"); }