mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-27 08:22:31 +00:00
be7ce4110e
This reverts commit e96515433d
.
34 lines
721 B
C++
34 lines
721 B
C++
#include <iostream>
|
|
|
|
#include <pqxx/transaction>
|
|
|
|
#include "test_helpers.hxx"
|
|
|
|
using namespace pqxx;
|
|
|
|
|
|
namespace
|
|
{
|
|
// Simple test program for libpqxx. Open connection to database, start
|
|
// a transaction, and perform a query inside it.
|
|
void test_001()
|
|
{
|
|
connection conn;
|
|
|
|
// Begin a transaction acting on our current connection. Give it a human-
|
|
// readable name so the library can include it in error messages.
|
|
work tx{conn, "test1"};
|
|
|
|
// Perform a query on the database, storing result rows in R.
|
|
result r(tx.exec("SELECT * FROM pg_tables"));
|
|
|
|
// We're expecting to find some tables...
|
|
PQXX_CHECK(not std::empty(r), "No tables found.");
|
|
|
|
tx.commit();
|
|
}
|
|
|
|
|
|
PQXX_REGISTER_TEST(test_001);
|
|
} // namespace
|