ThinSQLite++
A thin, safe and convenient modern C++ wrapper for SQLite API.
Loading...
Searching...
No Matches
auto_reset< Flags > Class Template Reference

RAII wrapper that resets statement on destruction. More...

Public Member Functions

 auto_reset ()
 Constructs an empty instance with no statement.
 
 auto_reset (const std::unique_ptr< statement > &st) noexcept
 Constructs an instance referring to a given statement.
 
 auto_reset (statement *st) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
 auto_reset (const auto_reset &)=delete
 
auto_resetoperator= (const auto_reset &)=delete
 
 auto_reset (auto_reset &&src) noexcept
 
auto_resetoperator= (auto_reset &&src) noexcept
 
 ~auto_reset () noexcept
 Resets the statement if present.
 
statementoperator-> () const noexcept
 Access the stored statement.
 

Detailed Description

template<auto_reset_flags Flags>
class thinsqlitepp::auto_reset< Flags >

RAII wrapper that resets statement on destruction.

This class allows you to restore the state of a statement after using it. This allows you to reuse the statement cleanly without having to worry about resetting it properly on different code paths.

Template Parameters
Flagsauto_reset_flags specifying what kind of reset to perform on destruction

Constructor & Destructor Documentation

◆ auto_reset()

template<auto_reset_flags Flags>
auto_reset ( const std::unique_ptr< statement > & st)
inlinenoexcept

Constructs an instance referring to a given statement.

The statement is being help by reference and must exist as long as this object is existing.