mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
PostgreSQL exceptions for serialization_failure and deadlock_detected (#551)
* Add the exception sqlpp::postgresql::serialization_failure * Add the exception sqlpp::postgresql::deadlock_detected
This commit is contained in:
parent
9b49afa306
commit
0cc45bd790
@ -288,6 +288,28 @@ namespace sqlpp
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_PUBLIC serialization_failure : public sql_error
|
||||
{
|
||||
public:
|
||||
explicit serialization_failure(std::string err) : sql_error{std::move(err)}
|
||||
{
|
||||
}
|
||||
serialization_failure(std::string err, std::string Q) : sql_error{std::move(err), std::move(Q)}
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_PUBLIC deadlock_detected : public sql_error
|
||||
{
|
||||
public:
|
||||
explicit deadlock_detected(std::string err) : sql_error{std::move(err)}
|
||||
{
|
||||
}
|
||||
deadlock_detected(std::string err, std::string Q) : sql_error{std::move(err), std::move(Q)}
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_PUBLIC syntax_error : public sql_error
|
||||
{
|
||||
public:
|
||||
|
@ -245,6 +245,11 @@ namespace sqlpp
|
||||
case '4':
|
||||
switch (code[1])
|
||||
{
|
||||
case '0':
|
||||
if (strcmp(code, "40001") == 0)
|
||||
throw serialization_failure{err, query};
|
||||
if (strcmp(code, "40P01") == 0)
|
||||
throw deadlock_detected{err, query};
|
||||
case '2':
|
||||
if (strcmp(code, "42501") == 0)
|
||||
throw insufficient_privilege{err, query};
|
||||
|
Loading…
Reference in New Issue
Block a user