diff options
| -rw-r--r-- | libdbpp/column.h | 1 | ||||
| -rw-r--r-- | libdbpp/connection.h | 7 | ||||
| -rw-r--r-- | libdbpp/selectcommand.h | 19 | ||||
| -rw-r--r-- | libdbpp/sqlParse.h | 21 | 
4 files changed, 37 insertions, 11 deletions
| diff --git a/libdbpp/column.h b/libdbpp/column.h index 8a4e203..981cde6 100644 --- a/libdbpp/column.h +++ b/libdbpp/column.h @@ -65,6 +65,7 @@ namespace DB {  			void operator>>(boost::posix_time::time_duration &) const;  			/// STL like date time extractor.  			void operator>>(boost::posix_time::ptime &) const; +			/// STL like wrapper for optional types.  			template <typename T>  			void operator>>(boost::optional<T> & v) const {  				if (!isNull()) { diff --git a/libdbpp/connection.h b/libdbpp/connection.h index e34315a..ab3882d 100644 --- a/libdbpp/connection.h +++ b/libdbpp/connection.h @@ -35,9 +35,13 @@ namespace DB {  	typedef ColumnNames PrimaryKey;  	typedef PrimaryKey::const_iterator PKI; +	/// Result of a table patch operation.  	struct PatchResult { +		/// Number of rows deleted.  		unsigned int deletes; +		/// Number of rows updated.  		unsigned int updates; +		/// Number of rows inserted.  		unsigned int inserts;  	}; @@ -60,8 +64,9 @@ namespace DB {  			SqlWriter * order;  	}; +	/// Exception thrown when attempting to perform a table patch with invalid settings.  	class DLL_PUBLIC PatchCheckFailure : public AdHoc::StdException { -		public: +		private:  			std::string message() const throw() override;  	}; diff --git a/libdbpp/selectcommand.h b/libdbpp/selectcommand.h index 1165de1..c29084a 100644 --- a/libdbpp/selectcommand.h +++ b/libdbpp/selectcommand.h @@ -16,20 +16,35 @@  namespace DB {  	class Column; + +	/// Exception thrown when the requested column is outside the range of the result set.  	class DLL_PUBLIC ColumnIndexOutOfRange : public AdHoc::Exception<Error> {  		public: +			/// New ColumnIndexOutOfRange exception +			/// @param n Index requested  			ColumnIndexOutOfRange(unsigned int n); -			std::string message() const throw() override; +			/// Index requested  			const unsigned int colNo; + +		private: +			std::string message() const throw() override;  	}; + +	/// Exception thrown when the requested column does not exist in the result set.  	class DLL_PUBLIC ColumnDoesNotExist : public AdHoc::Exception<Error> {  		public: +			/// New ColumnDoesNotExist exception +			/// @param n Name requested  			ColumnDoesNotExist(const Glib::ustring & n); -			std::string message() const throw() override; +			/// Name requested  			const Glib::ustring colName; + +		private: +			std::string message() const throw() override;  	}; +  	/// Represents a command expected to return data to the client.  	class DLL_PUBLIC SelectCommand : public virtual Command {  		public: diff --git a/libdbpp/sqlParse.h b/libdbpp/sqlParse.h index 3c8add0..d56bce9 100644 --- a/libdbpp/sqlParse.h +++ b/libdbpp/sqlParse.h @@ -12,14 +12,19 @@  #endif  namespace DB { -class DLL_PUBLIC SqlParseException : public AdHoc::StdException { -	public: -		SqlParseException(const char *, unsigned int); -	private: -		std::string message() const throw() override; -		const char * reason; -		const unsigned int line; -}; +	/// Exception representing a failure to parse an SQL script +	class DLL_PUBLIC SqlParseException : public AdHoc::StdException { +		public: +			/// Create a new SqlParseException +			/// @param what What went wrong +			/// @param line What line number +			SqlParseException(const char * what, unsigned int line); + +		private: +			std::string message() const throw() override; +			const char * reason; +			const unsigned int line; +	};  /// @cond  class SqlParse : public yyFlexLexer { | 
