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

Method get_error_category

src/backends/postgresql/error.cpp:26–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26soci_error::error_category postgresql_soci_error::get_error_category() const
27{
28 if (std::memcmp(sqlstate_, "08", 2) == 0)
29 {
30 return connection_error;
31 }
32 else if (std::memcmp(sqlstate_, "42501", 5) == 0 ||
33 std::memcmp(sqlstate_, "25006", 5) == 0)
34 {
35 return no_privilege;
36 }
37 else if (std::memcmp(sqlstate_, "42", 2) == 0)
38 {
39 return invalid_statement;
40 }
41 else if (std::memcmp(sqlstate_, "02", 2) == 0)
42 {
43 return no_data;
44 }
45 else if (std::memcmp(sqlstate_, "23", 2) == 0)
46 {
47 return constraint_violation;
48 }
49 else if ((std::memcmp(sqlstate_, "53", 2) == 0) ||
50 (std::memcmp(sqlstate_, "54", 2) == 0) ||
51 (std::memcmp(sqlstate_, "58", 2) == 0) ||
52 (std::memcmp(sqlstate_, "XX", 2) == 0))
53 {
54 return system_error;
55 }
56
57 return unknown;
58}
59
60std::string postgresql_soci_error::get_sqlstate() const
61{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected