From 7e704a7e6e57cf877614fd762d4667ef32be2eea Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 16 Nov 2011 10:59:14 +0200 Subject: Add build infrastructure, options file and exceptions implementation --- odb/mssql/exceptions.hxx | 116 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 odb/mssql/exceptions.hxx (limited to 'odb/mssql/exceptions.hxx') diff --git a/odb/mssql/exceptions.hxx b/odb/mssql/exceptions.hxx new file mode 100644 index 0000000..321a41d --- /dev/null +++ b/odb/mssql/exceptions.hxx @@ -0,0 +1,116 @@ +// file : odb/mssql/exceptions.hxx +// author : Constantin Michael +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : ODB NCUEL; see accompanying LICENSE file + +#ifndef ODB_MSSQL_EXCEPTIONS_HXX +#define ODB_MSSQL_EXCEPTIONS_HXX + +#include + +#include +#include + +#include + +#include +#include +#include + +namespace odb +{ + namespace mssql + { + struct LIBODB_MSSQL_EXPORT database_exception: odb::database_exception + { + struct record + { + record (SQLINTEGER error, + const std::string& sqlstate, + const std::string& message); + + SQLINTEGER + error () const + { + return error_; + } + + const std::string& + sqlstate () const + { + return sqlstate_; + } + + const std::string& + message () const + { + return message_; + } + + private: + SQLINTEGER error_; + std::string sqlstate_; + std::string message_; + }; + + typedef std::vector records; + + typedef records::size_type size_type; + typedef records::const_iterator iterator; + + iterator + begin () const + { + return records_.begin (); + } + + iterator + end () const + { + return records_.end (); + } + + size_type + size () const + { + return records_.size (); + } + + virtual const char* + what () const throw (); + + public: + ~database_exception () throw (); + + database_exception (); + database_exception (SQLINTEGER error, + const std::string& sqlstate, + const std::string& message); + + void + append (SQLINTEGER error, + const std::string& sqlstate, + const std::string& message); + + private: + records records_; + std::string what_; + }; + + struct LIBODB_MSSQL_EXPORT cli_exception: odb::exception + { + cli_exception (const std::string& what); + ~cli_exception () throw (); + + virtual const char* + what () const throw (); + + private: + std::string what_; + }; + } +} + +#include + +#endif // ODB_MSSQL_EXCEPTIONS_HXX -- cgit v1.1