diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-04 16:45:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-04 16:45:36 +0200 |
commit | fcfe083c7a6d12eb4b6b88eea4a5ebbfc4d36995 (patch) | |
tree | ba60af2863d425e8be78749558c73910ab2f921d /odb/mysql/exceptions.hxx | |
parent | 073918a2f4bff3a6f12cfd722db50e3fb0a6db0d (diff) |
Initial implementation
Diffstat (limited to 'odb/mysql/exceptions.hxx')
-rw-r--r-- | odb/mysql/exceptions.hxx | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/odb/mysql/exceptions.hxx b/odb/mysql/exceptions.hxx new file mode 100644 index 0000000..a4e729b --- /dev/null +++ b/odb/mysql/exceptions.hxx @@ -0,0 +1,54 @@ +// file : odb/mysql/exceptions.hxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2005-2010 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_MYSQL_EXCEPTIONS_HXX +#define ODB_MYSQL_EXCEPTIONS_HXX + +#include <string> + +#include <mysql/mysql.h> + +#include <odb/exceptions.hxx> + +namespace odb +{ + namespace mysql + { + struct database_exception: odb::database_exception + { + database_exception (MYSQL*); + ~database_exception () throw (); + + unsigned int + error () const + { + return error_; + } + + const std::string& + sqlstate () const + { + return sqlstate_; + } + + const std::string& + message () const + { + return message_; + } + + virtual char const* + what () const throw (); + + private: + unsigned int error_; + std::string sqlstate_; + std::string message_; + std::string what_; + }; + } +} + +#endif // ODB_MYSQL_EXCEPTIONS_HXX |