diff options
author | rtk0c <[email protected]> | 2022-05-22 14:54:06 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-05-22 14:54:06 -0700 |
commit | 55c4420b69fa172ac7b6b3523597b9a46a5d1bcd (patch) | |
tree | 407fbd2fd7911b8bfa8567502d7493708036be2f /3rdparty/sqlitecpp/source/SQLiteCpp/Exception.cpp | |
parent | 195e30b1e39fa4dc535172ba248f0c18733dcb3c (diff) |
Vendor SQLiteCpp completely for internal patching
Diffstat (limited to '3rdparty/sqlitecpp/source/SQLiteCpp/Exception.cpp')
-rw-r--r-- | 3rdparty/sqlitecpp/source/SQLiteCpp/Exception.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/3rdparty/sqlitecpp/source/SQLiteCpp/Exception.cpp b/3rdparty/sqlitecpp/source/SQLiteCpp/Exception.cpp new file mode 100644 index 0000000..0dc644f --- /dev/null +++ b/3rdparty/sqlitecpp/source/SQLiteCpp/Exception.cpp @@ -0,0 +1,47 @@ +/** + * @file Exception.cpp + * @ingroup SQLiteCpp + * @brief Encapsulation of the error message from SQLite3 on a std::runtime_error. + * + * Copyright (c) 2012-2021 Sebastien Rombauts ([email protected]) + * + * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt + * or copy at http://opensource.org/licenses/MIT) + */ +#include <SQLiteCpp/Exception.h> + +#include <sqlite3.h> + + +namespace SQLite +{ + +Exception::Exception(const char* aErrorMessage, int ret) : + std::runtime_error(aErrorMessage), + mErrcode(ret), + mExtendedErrcode(-1) +{ +} + +Exception::Exception(sqlite3* apSQLite) : + std::runtime_error(sqlite3_errmsg(apSQLite)), + mErrcode(sqlite3_errcode(apSQLite)), + mExtendedErrcode(sqlite3_extended_errcode(apSQLite)) +{ +} + +Exception::Exception(sqlite3* apSQLite, int ret) : + std::runtime_error(sqlite3_errmsg(apSQLite)), + mErrcode(ret), + mExtendedErrcode(sqlite3_extended_errcode(apSQLite)) +{ +} + +// Return a string, solely based on the error code +const char* Exception::getErrorStr() const noexcept +{ + return sqlite3_errstr(mErrcode); +} + + +} // namespace SQLite |