mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-21 12:06:11 +00:00
be7ce4110e
This reverts commit e96515433d
.
23 lines
490 B
C++
23 lines
490 B
C++
#include <pqxx/transaction>
|
|
|
|
#include "../test_helpers.hxx"
|
|
|
|
namespace
|
|
{
|
|
void test_read_transaction()
|
|
{
|
|
pqxx::connection conn;
|
|
pqxx::read_transaction tx{conn};
|
|
PQXX_CHECK_EQUAL(
|
|
tx.exec("SELECT 1")[0][0].as<int>(), 1,
|
|
"Bad result from read transaction.");
|
|
|
|
PQXX_CHECK_THROWS(
|
|
tx.exec("CREATE TABLE should_not_exist(x integer)"), pqxx::sql_error,
|
|
"Read-only transaction allows database to be modified.");
|
|
}
|
|
|
|
|
|
PQXX_REGISTER_TEST(test_read_transaction);
|
|
} // namespace
|