1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <iostream>
#include "test_helpers.hxx"
using namespace PGSTD;
using namespace pqxx;
// Simple test program for libpqxx. Open connection to database, start
// a dummy transaction to gain nontransactional access, and perform a query.
namespace
{
void test_033(transaction_base &T)
{
result R( T.exec("SELECT * FROM pg_tables") );
for (result::const_iterator c = R.begin(); c != R.end(); ++c)
{
string N;
c[0].to(N);
cout << '\t' << to_string(c.num()) << '\t' << N << endl;
}
// "Commit" the non-transaction. This doesn't really do anything since
// nontransaction doesn't start a backend transaction.
T.commit();
}
} // namespace
PQXX_REGISTER_TEST_CT(test_033, lazyconnection, nontransaction)
|