Skip to content
Snippets Groups Projects
connection.hh 651 B
Newer Older
  • Learn to ignore specific revisions
  • Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
    #ifndef __VEREIGN_SQLITE_CONNECTION_HH
    #define __VEREIGN_SQLITE_CONNECTION_HH
    
    
    #include <vereign/sqlite/statement.hh>
    
    Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
    
    struct sqlite3;
    struct sqlite3_stmt;
    
    namespace vereign::sqlite {
    
    class Connection {
    public:
      Connection(const std::string& path);
      ~Connection() noexcept;
    
      Connection(const Connection&) = delete;
      auto operator=(const Connection&) -> Connection& = delete;
    
    
      void BeginExplicitTransaction();
      void Commit();
      void Rollback();
    
    
    Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
      void Execute(const std::string& sql);
      auto Prepare(const std::string& sql) -> Statement;
    
    Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
    private:
      sqlite3* db_;
    };
    
    } // namespace vereign::sqlite
    
    #endif // __VEREIGN_SQLITE_CONNECTION_HH