Skip to content
Snippets Groups Projects
statement.hh 785 B
Newer Older
  • Learn to ignore specific revisions
  • #ifndef __VEREIGN_SQLITE_STATEMENT_HH
    #define __VEREIGN_SQLITE_STATEMENT_HH
    
    #include <vereign/bytes/view.hh>
    #include <vereign/bytes/bytes.hh>
    
    #include <string>
    
    struct sqlite3;
    struct sqlite3_stmt;
    
    namespace vereign::sqlite {
    
    class Statement {
    private:
      friend class Connection;
    
      explicit Statement(sqlite3* db, sqlite3_stmt* stmt);
    
    public:
      ~Statement();
    
      void BindBlob(int index, bytes::View blob);
      void BindText(int index, const std::string& text);
    
      auto Step() -> bool;
    
      auto GetColumnBlob(int index) -> bytes::View;
      auto GetColumnText(int index) -> std::string_view;
    
      void Reset();
      void ResetAndClearBindings();
      void Finalize();
    
    private:
      sqlite3* db_;
      sqlite3_stmt* stmt_;
    };
    
    } // namespace vereign::sqlite
    
    #endif // __VEREIGN_SQLITE_STATEMENT_HH