12 : mConnection(
std::move(connection))
25 *openError = connection.GetError();
30 return std::make_shared<SafeConnection>(
Tag {}, std::move(*connection));
42 *openError = connection.GetError();
47 return std::make_shared<SafeConnection>(
Tag {}, std::move(*connection));
59 *openError = connection.GetError();
64 return std::make_shared<SafeConnection>(
Tag {}, std::move(*connection));
77 *openError = connection.GetError();
82 return std::make_shared<SafeConnection>(
Tag {}, std::move(*connection));
87 return Lock { shared_from_this() };
91 : mSafeConnection(
std::move(connection))
117SafeConnection::Lock::operator bool() const noexcept
124 return mSafeConnection !=
nullptr;
A class representing a connection to a SQLite database.
static Result< Connection > Reopen(const Connection &connection, OpenMode mode=OpenMode::ReadWriteCreate, ThreadMode threadMode=ThreadMode::Serialized)
static Result< Connection > Open(std::string_view path, OpenMode mode=OpenMode::ReadWriteCreate, ThreadMode threadMode=ThreadMode::Serialized)
Opens a connection to a database.
A class representing an error in SQLite.
A class representing a safe connection to SQLite.
static std::shared_ptr< SafeConnection > Reopen(const Connection &connection, OpenMode mode=OpenMode::ReadWriteCreate, ThreadMode threadMode=ThreadMode::Serialized, Error *openError=nullptr)
SafeConnection(Tag, Connection connection)
static std::shared_ptr< SafeConnection > Open(std::string_view path, OpenMode mode=OpenMode::ReadWriteCreate, ThreadMode threadMode=ThreadMode::Serialized, Error *openError=nullptr)
OpenMode
The mode in which the database should be opened.
ThreadMode
The mode in which the database should be accessed.
std::shared_ptr< SafeConnection > mSafeConnection
Lock(std::shared_ptr< SafeConnection > connection)
Connection & operator*() noexcept
Connection * operator->() noexcept
bool IsValid() const noexcept
std::unique_lock< MutexType > mLock