31 #if !defined(MYSQLPP_EXCEPTIONS_H)
32 #define MYSQLPP_EXCEPTIONS_H
45 class MYSQLPP_EXPORT
Exception :
public std::exception
66 virtual const char*
what()
const throw()
107 size_t r,
size_t a) :
114 what_ += d ? d :
"<NULL>";
115 what_ +=
"\" incompatible with \"";
128 const char* d,
size_t r,
size_t a) :
144 type_name(
"unknown"),
168 Exception(std::string(
"Unknown field name: ") + bad_field)
188 explicit BadIndex(
const char* what,
int bad_index,
int max_index) :
191 std::ostringstream outs;
192 outs <<
"Index " << bad_index <<
" on " << what <<
193 " out of range, max legal index is " << max_index;
209 explicit BadOption(
const char* w,
const std::type_info& ti) :
216 explicit BadOption(
const std::string& w,
const std::type_info& ti) :
229 const std::type_info& ti_;
302 explicit BadQuery(
const std::string& w,
int e = 0) :
Exception thrown when a bad type conversion is attempted.
Definition: exceptions.h:92
BadConversion(const char *w="")
Create exception object, with error string only.
Definition: exceptions.h:142
std::string data
string form of data we tried to convert
Definition: exceptions.h:95
size_t actual_size
documentation needed!
Definition: exceptions.h:97
~BadConversion()
Destroy exception.
Definition: exceptions.h:152
BadConversion(const char *tn, const char *d, size_t r, size_t a)
Create exception object, building error string dynamically.
Definition: exceptions.h:106
const char * type_name
name of type we tried to convert to
Definition: exceptions.h:94
BadConversion(const std::string &w, const char *tn, const char *d, size_t r, size_t a)
Create exception object, given completed error string.
Definition: exceptions.h:127
size_t retrieved
documentation needed!
Definition: exceptions.h:96
Exception thrown when a requested named field doesn't exist.
Definition: exceptions.h:162
~BadFieldName()
Destroy exception.
Definition: exceptions.h:173
BadFieldName(const char *bad_field)
Create exception object.
Definition: exceptions.h:167
Exception thrown when an object with operator [] or an at() method gets called with a bad index.
Definition: exceptions.h:181
BadIndex(const char *what, int bad_index, int max_index)
Create exception object.
Definition: exceptions.h:188
~BadIndex()
Destroy exception.
Definition: exceptions.h:198
Exception thrown when an insert policy is too strict to create a valid INSERT statement.
Definition: exceptions.h:457
BadInsertPolicy(const std::string &w)
Create exception object.
Definition: exceptions.h:460
Exception thrown when you pass an unrecognized option to Connection::set_option().
Definition: exceptions.h:206
BadOption(const std::string &w, const std::type_info &ti)
Create exception object, taking C++ string.
Definition: exceptions.h:216
const std::type_info & what_option() const
Return type information about the option that failed.
Definition: exceptions.h:226
BadOption(const char *w, const std::type_info &ti)
Create exception object, taking C string.
Definition: exceptions.h:209
Exception thrown when not enough query parameters are provided.
Definition: exceptions.h:239
~BadParamCount()
Destroy exception.
Definition: exceptions.h:248
BadParamCount(const char *w="")
Create exception object.
Definition: exceptions.h:242
Exception thrown when the database server encounters a problem while processing your query.
Definition: exceptions.h:286
BadQuery(const std::string &w, int e=0)
Create exception object.
Definition: exceptions.h:302
BadQuery(const char *w="", int e=0)
Create exception object.
Definition: exceptions.h:292
int errnum() const
Return the error number corresponding to the error message returned by what()
Definition: exceptions.h:314
Exception thrown when there is a problem related to the database server connection.
Definition: exceptions.h:329
int errnum() const
Return the error number corresponding to the error message returned by what(), if any.
Definition: exceptions.h:349
ConnectionFailed(const char *w="", int e=0)
Create exception object.
Definition: exceptions.h:335
Exception thrown when the program tries to select a new database and the database server refuses for ...
Definition: exceptions.h:360
int errnum() const
Return the error number corresponding to the error message returned by what(), if any.
Definition: exceptions.h:380
DBSelectionFailed(const char *w="", int e=0)
Create exception object.
Definition: exceptions.h:366
Base class for all MySQL++ custom exceptions.
Definition: exceptions.h:46
Exception & operator=(const Exception &rhs)
Assign another exception object's contents to this one.
Definition: exceptions.h:56
~Exception()
Destroy exception object.
Definition: exceptions.h:63
std::string what_
explanation of why exception was thrown
Definition: exceptions.h:85
Exception(const std::string &w)
Create exception object.
Definition: exceptions.h:79
Exception(const Exception &e) MAY_THROW()
Create exception object as copy of another.
Definition: exceptions.h:49
Exception(const char *w="")
Create exception object.
Definition: exceptions.h:73
virtual const char * what() const
Returns explanation of why exception was thrown.
Definition: exceptions.h:66
Exception thrown when a BeecryptMutex object fails.
Definition: exceptions.h:390
MutexFailed(const char *w="lock failed")
Create exception object.
Definition: exceptions.h:393
Exception thrown when you try to use an object that isn't completely initialized.
Definition: exceptions.h:404
ObjectNotInitialized(const char *w="")
Create exception object.
Definition: exceptions.h:407
Used within MySQL++'s test harness only.
Definition: exceptions.h:417
SelfTestFailed(const std::string &w)
Create exception object.
Definition: exceptions.h:420
Thrown from the C++ to SQL data type conversion routine when it can't figure out how to map the type.
Definition: exceptions.h:439
TypeLookupFailed(const std::string &w)
Create exception object.
Definition: exceptions.h:442
Exception thrown when something goes wrong in processing a "use" query.
Definition: exceptions.h:255
UseQueryError(const char *w="")
Create exception object.
Definition: exceptions.h:258
Declares the Option class hierarchy, used to implement connection options in Connection and DBDriver ...