mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-06 02:59:45 +00:00
28 lines
521 B
C++
28 lines
521 B
C++
|
#include <pqxx/transaction>
|
||
|
|
||
|
#include <pqxx/internal/wait.hxx>
|
||
|
|
||
|
#include "../test_helpers.hxx"
|
||
|
|
||
|
|
||
|
namespace
|
||
|
{
|
||
|
void test_nonblocking_connect()
|
||
|
{
|
||
|
pqxx::connecting nbc;
|
||
|
while (not nbc.done())
|
||
|
{
|
||
|
pqxx::internal::wait_fd(
|
||
|
nbc.sock(), nbc.wait_to_read(), nbc.wait_to_write());
|
||
|
nbc.process();
|
||
|
}
|
||
|
|
||
|
pqxx::connection conn{std::move(nbc).produce()};
|
||
|
pqxx::work tx{conn};
|
||
|
PQXX_CHECK_EQUAL(tx.query_value<int>("SELECT 10"), 10, "Bad value!?");
|
||
|
}
|
||
|
|
||
|
|
||
|
PQXX_REGISTER_TEST(test_nonblocking_connect);
|
||
|
} // namespace
|