mirror of
https://github.com/allankoechke/SQLiteCpp.git
synced 2026-11-30 17:07:36 +00:00
Add SQLite::Exception constructor that takes const char* in order to avoid possible std::bad_alloc exception
std::runtime_error provides such overload in c++11, therefore it will make no difference when compiling for c++03, but should provide no harm either
This commit is contained in:
@@ -16,6 +16,12 @@
|
||||
namespace SQLite
|
||||
{
|
||||
|
||||
Exception::Exception(const char* aErrorMessage) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(-1), // 0 would be SQLITE_OK, which doesn't make sense
|
||||
mExtendedErrcode(-1)
|
||||
{
|
||||
}
|
||||
Exception::Exception(const std::string& aErrorMessage) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(-1), // 0 would be SQLITE_OK, which doesn't make sense
|
||||
@@ -23,6 +29,13 @@ Exception::Exception(const std::string& aErrorMessage) :
|
||||
{
|
||||
}
|
||||
|
||||
Exception::Exception(const char* aErrorMessage, int ret) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(ret),
|
||||
mExtendedErrcode(-1)
|
||||
{
|
||||
}
|
||||
|
||||
Exception::Exception(const std::string& aErrorMessage, int ret) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(ret),
|
||||
|
||||
Reference in New Issue
Block a user