44 lines
871 B
C++
44 lines
871 B
C++
#ifndef SQL_ERROR_CODE_HPP
|
|
#define SQL_ERROR_CODE_HPP
|
|
|
|
#include <cstdint>
|
|
#include <system_error>
|
|
|
|
namespace matador::sql {
|
|
|
|
enum class error_code : uint8_t {
|
|
OK = 0,
|
|
INVALID_QUERY,
|
|
UNKNOWN_TABLE,
|
|
UNKNOWN_COLUMN,
|
|
BIND_FAILED,
|
|
EXECUTE_FAILED,
|
|
FETCH_FAILED,
|
|
PREPARE_FAILED,
|
|
DESCRIBE_FAILED,
|
|
TABLE_EXISTS_FAILED,
|
|
RETRIEVE_DATA_FAILED,
|
|
RESET_FAILED,
|
|
OPEN_ERROR,
|
|
CLOSE_ERROR,
|
|
FAILURE
|
|
};
|
|
|
|
class sql_category_impl final : public std::error_category
|
|
{
|
|
public:
|
|
[[nodiscard]] const char* name() const noexcept override;
|
|
[[nodiscard]] std::string message(int ev) const override;
|
|
};
|
|
|
|
const std::error_category& sql_category();
|
|
std::error_code make_error_code(error_code e);
|
|
std::error_condition make_error_condition(error_code e);
|
|
|
|
}
|
|
|
|
template <>
|
|
struct std::is_error_code_enum<matador::sql::error_code> : true_type {};
|
|
|
|
#endif //SQL_ERROR_CODE_HPP
|