backend tests progress
This commit is contained in:
@@ -22,9 +22,12 @@ void throw_postgres_error(PGconn *db, const std::string &source)
|
||||
|
||||
void throw_postgres_error(PGresult *res, PGconn *db, const std::string &source, const std::string &sql)
|
||||
{
|
||||
if (res == nullptr ||
|
||||
(PQresultStatus(res) != PGRES_COMMAND_OK &&
|
||||
PQresultStatus(res) != PGRES_TUPLES_OK)) {
|
||||
if (res == nullptr) {
|
||||
std::stringstream msg;
|
||||
msg << "postgres error (" << source << ", " << PQerrorMessage(db) << ": " << sql;
|
||||
throw std::logic_error(msg.str());
|
||||
} else if ((PQresultStatus(res) != PGRES_COMMAND_OK &&
|
||||
PQresultStatus(res) != PGRES_TUPLES_OK)) {
|
||||
std::stringstream msg;
|
||||
msg << "postgres error (" << source << ", " << PQresultErrorField(res, PG_DIAG_SQLSTATE) << ") " << PQerrorMessage(db) << ": " << sql;
|
||||
throw std::logic_error(msg.str());
|
||||
|
||||
@@ -24,7 +24,8 @@ set(TEST_SOURCES
|
||||
../../tests/ConnectionTest.cpp
|
||||
../../tests/SessionRecordTest.cpp
|
||||
../../tests/StatementTest.cpp
|
||||
../../tests/TypeTraitsTest.cpp)
|
||||
../../tests/TypeTraitsTest.cpp
|
||||
../../tests/StatementCacheTest.cpp)
|
||||
|
||||
set(LIBRARY_TEST_TARGET postgres_tests)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user