mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
b7ef5a699c
* Get rid of non-existent vectorclass * Move FastMemcpy to contribs * Restore comments * Disable FastMemcpy on non-Linux * Fix cmake file * Don't build FastMemcpy for ARM64 * Replace FastMemcpy submodule with its contents * Fix cmake file * Move widechar_width to contrib/ * Move sumbur to contrib/ * Move consistent-hashing to contrib/ * Fix UBSan tests
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <sstream>
|
|
#include <Poco/Exception.h>
|
|
#include <mysqlxx/Types.h>
|
|
|
|
|
|
namespace mysqlxx
|
|
{
|
|
/// Common exception class for MySQL library. Functions code() and errnum() return error numbers from MySQL, for details see mysqld_error.h
|
|
struct Exception : public Poco::Exception
|
|
{
|
|
Exception(const std::string & msg, int code = 0) : Poco::Exception(msg, code) {}
|
|
int errnum() const { return code(); }
|
|
const char * name() const throw() override { return "mysqlxx::Exception"; }
|
|
const char * className() const throw() override { return "mysqlxx::Exception"; }
|
|
};
|
|
|
|
|
|
/// Cannot connect to MySQL server
|
|
struct ConnectionFailed : public Exception
|
|
{
|
|
ConnectionFailed(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
|
const char * name() const throw() override { return "mysqlxx::ConnectionFailed"; }
|
|
const char * className() const throw() override { return "mysqlxx::ConnectionFailed"; }
|
|
};
|
|
|
|
|
|
/// Erroneous query.
|
|
struct BadQuery : public Exception
|
|
{
|
|
BadQuery(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
|
const char * name() const throw() override { return "mysqlxx::BadQuery"; }
|
|
const char * className() const throw() override { return "mysqlxx::BadQuery"; }
|
|
};
|
|
|
|
|
|
/// Value parsing failure
|
|
struct CannotParseValue : public Exception
|
|
{
|
|
CannotParseValue(const std::string & msg, int code = 0) : Exception(msg, code) {}
|
|
const char * name() const throw() override { return "mysqlxx::CannotParseValue"; }
|
|
const char * className() const throw() override { return "mysqlxx::CannotParseValue"; }
|
|
};
|
|
|
|
|
|
std::string errorMessage(MYSQL * driver);
|
|
|
|
/// For internal need of library.
|
|
void checkError(MYSQL * driver);
|
|
void onError(MYSQL * driver);
|
|
|
|
}
|