|
@@ -669,8 +669,22 @@ private:
|
|
|
/// @brief Check Error and Throw Exception
|
|
|
///
|
|
|
/// Virtually all MySQL functions return a status which, if non-zero,
|
|
|
- /// indicates an error. This inline function conceals a lot of error
|
|
|
- /// checking/exception-throwing code.
|
|
|
+ /// indicates an error. This function centralizes the error checking
|
|
|
+ /// code.
|
|
|
+ ///
|
|
|
+ /// It is used to determine whether or not the function succeeded, and
|
|
|
+ /// in the event of failures, decide whether or not those failures are
|
|
|
+ /// recoverable.
|
|
|
+ ///
|
|
|
+ /// If the error is recoverable, the method will throw a DbOperationError.
|
|
|
+ /// In the error is deemed unrecoverable, such as a loss of connectivity
|
|
|
+ /// with the server, this method will log the error and call exit(-1);
|
|
|
+ ///
|
|
|
+ /// @todo Calling exit() is viewed as a short term solution for Kea 1.0.
|
|
|
+ /// Two tickets are likely to alter this behavior, first is #3639, which
|
|
|
+ /// calls for the ability to attempt to reconnect to the database. The
|
|
|
+ /// second ticket, #4087 which calls for the implementation of a generic,
|
|
|
+ /// FatalException class which will propagate outward.
|
|
|
///
|
|
|
/// @param status Status code: non-zero implies an error
|
|
|
/// @param index Index of statement that caused the error
|
|
@@ -678,15 +692,8 @@ private:
|
|
|
///
|
|
|
/// @throw isc::dhcp::DbOperationError An operation on the open database has
|
|
|
/// failed.
|
|
|
- inline void checkError(int status, StatementIndex index,
|
|
|
- const char* what) const {
|
|
|
- if (status != 0) {
|
|
|
- isc_throw(DbOperationError, what << " for <" <<
|
|
|
- conn_.text_statements_[index] << ">, reason: " <<
|
|
|
- mysql_error(conn_.mysql_) << " (error code " <<
|
|
|
- mysql_errno(conn_.mysql_) << ")");
|
|
|
- }
|
|
|
- }
|
|
|
+ void checkError(int status, StatementIndex index,
|
|
|
+ const char* what) const;
|
|
|
|
|
|
// Members
|
|
|
|