MCPcopy Create free account
hub / github.com/SOCI/soci / get_postgresql_version

Function get_postgresql_version

tests/postgresql/test-postgresql.cpp:630–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628typedef std::pair<int,int> server_version;
629
630server_version get_postgresql_version(soci::session& sql)
631{
632 std::string version;
633 std::pair<int,int> result;
634 sql << "select version()",into(version);
635 if (soci::sscanf(version.c_str(),"PostgreSQL %i.%i", &result.first, &result.second) < 2)
636 {
637 throw std::runtime_error("Failed to retrieve PostgreSQL version number");
638 }
639 return result;
640}
641
642// Test JSON. Only valid for PostgreSQL Server 9.2++
643TEST_CASE("PostgreSQL JSON", "[postgresql][json]")

Callers 1

Calls 2

sscanfFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected