-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql_error.cpp
More file actions
44 lines (35 loc) · 1.55 KB
/
sql_error.cpp
File metadata and controls
44 lines (35 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "pch.hpp"
#include "sql_error.hpp"
#include "result_code.hpp"
namespace be::sqlite {
///////////////////////////////////////////////////////////////////////////////
SqlError::SqlError(std::error_code ec, S sql)
: RecoverableError(ec, ec.message()),
sql_(std::move(sql)) { }
///////////////////////////////////////////////////////////////////////////////
SqlError::SqlError(std::error_code ec, const S& msg, S sql)
: RecoverableError(ec, msg),
sql_(std::move(sql)) { }
///////////////////////////////////////////////////////////////////////////////
SqlError::SqlError(sqlite3* con, S sql)
: RecoverableError(ext_result_code(sqlite3_extended_errcode(con)), sqlite3_errmsg(con)),
sql_(std::move(sql)) { }
///////////////////////////////////////////////////////////////////////////////
SqlError::SqlError(sqlite3* con, std::error_code ec, S sql)
: RecoverableError(ec, sqlite3_errmsg(con)),
sql_(std::move(sql)) { }
///////////////////////////////////////////////////////////////////////////////
SqlError::SqlError(SqlError&& other) noexcept
: RecoverableError(other.code(), other.what()),
sql_(std::move(other.sql_)) { }
///////////////////////////////////////////////////////////////////////////////
SqlError& SqlError::operator=(SqlError&& other) noexcept {
*((RecoverableError*)this) = *(RecoverableError*)&other;
sql_ = std::move(other.sql_);
return *this;
}
///////////////////////////////////////////////////////////////////////////////
const S& SqlError::sql() const noexcept {
return sql_;
}
} // be::sqlite