From 74d9ab3518d50ebafb12e8252c01fa904b089481 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Fri, 6 May 2011 11:44:02 +0200 Subject: Add error support --- odb/pgsql/exceptions.cxx | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'odb/pgsql/exceptions.cxx') 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 + #include 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) { } -- cgit v1.1