aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/exceptions.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-06-04 16:45:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-06-04 16:45:36 +0200
commitfcfe083c7a6d12eb4b6b88eea4a5ebbfc4d36995 (patch)
treeba60af2863d425e8be78749558c73910ab2f921d /odb/mysql/exceptions.hxx
parent073918a2f4bff3a6f12cfd722db50e3fb0a6db0d (diff)
Initial implementation
Diffstat (limited to 'odb/mysql/exceptions.hxx')
-rw-r--r--odb/mysql/exceptions.hxx54
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