diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-05-06 11:44:02 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-05-09 16:52:07 +0200 |
commit | 74d9ab3518d50ebafb12e8252c01fa904b089481 (patch) | |
tree | 456be9c02055d01f27614bf6cb204f0c78c2a848 /odb/pgsql/exceptions.cxx | |
parent | 77bbae6038d20576a4807ed8ca834685a1e85afa (diff) |
Add error support
Diffstat (limited to 'odb/pgsql/exceptions.cxx')
-rw-r--r-- | odb/pgsql/exceptions.cxx | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/odb/pgsql/exceptions.cxx b/odb/pgsql/exceptions.cxx index bea0870..bec4ba7 100644 --- a/odb/pgsql/exceptions.cxx +++ b/odb/pgsql/exceptions.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file +#include <sstream> + #include <odb/pgsql/exceptions.hxx> using namespace std; @@ -12,12 +14,41 @@ namespace odb namespace pgsql { // + // database_exception + // + + database_exception:: + database_exception (const string& message) + : message_ (message), what_ (message) + { + } + + database_exception:: + database_exception (const string& sqlstate, + const string& message) + : sqlstate_ (sqlstate), message_ (message) + { + what_ = sqlstate_ + ": " + message_; + } + + database_exception:: + ~database_exception () throw () + { + } + + const char* database_exception:: + what () const throw () + { + return what_.c_str (); + } + + // // cli_exception // cli_exception:: - cli_exception (const std::string& what) - : what_ (what) + cli_exception (const string& w) + : what_ (w) { } |