SQLiteResultSet.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef SQLITERESULTSET_H
  2. #define SQLITERESULTSET_H
  3. #include "SQLiteStatement.h"
  4. #include <string>
  5. #include <vector>
  6. #include <stdint.h>
  7. namespace SQLite {
  8. class SQLiteResultSet
  9. {
  10. public:
  11. SQLiteResultSet(SQLiteStatement& statement);
  12. public:
  13. void AfterLast();
  14. void BeforeFirst();
  15. bool First();
  16. bool IsAfterLast() const;
  17. bool IsBeforeFirst() const;
  18. bool IsFirst() const;
  19. bool IsLast() const;
  20. bool Last();
  21. bool Next();
  22. bool Previous();
  23. size_t Row() const;
  24. size_t RowsCount() const;
  25. bool Empty() const;
  26. uint32_t FindColumn(const std::string& columnName) const;
  27. long double Double(uint32_t columnIndex) const;
  28. long double Double(const std::string& columnLabel) const;
  29. int32_t Int(uint32_t columnIndex) const;
  30. int32_t Int(const std::string& columnLabel) const;
  31. std::string String(uint32_t columnIndex) const;
  32. std::string String(const std::string& columnName) const;
  33. void Print() const;
  34. private:
  35. int Size() const;
  36. int LastIndex() const;
  37. private:
  38. std::vector<std::string> m_columns;
  39. std::vector<std::vector<std::string>> m_values;
  40. int m_currentRow;
  41. };
  42. } // namespace SQLite
  43. #endif // SQLITERESULTSET_H