52 lines
2.0 KiB
C++
52 lines
2.0 KiB
C++
#ifndef QUERY_SQLITE_RESULT_READER_HPP
|
|
#define QUERY_SQLITE_RESULT_READER_HPP
|
|
|
|
#include "matador/sql/query_result_reader.hpp"
|
|
|
|
#include <vector>
|
|
|
|
namespace matador::backends::sqlite {
|
|
|
|
class sqlite_result_reader : public sql::query_result_reader
|
|
{
|
|
public:
|
|
using columns = std::vector<char*>;
|
|
using rows = std::vector<columns>;
|
|
|
|
public:
|
|
sqlite_result_reader(rows result, size_t column_count);
|
|
~sqlite_result_reader() override;
|
|
|
|
size_t column_count() const override;
|
|
|
|
[[nodiscard]] const char* column(size_t index) const override;
|
|
[[nodiscard]] bool fetch() override;
|
|
|
|
void read_value(const char *id, size_t index, char &value) override;
|
|
void read_value(const char *id, size_t index, short &value) override;
|
|
void read_value(const char *id, size_t index, int &value) override;
|
|
void read_value(const char *id, size_t index, long &value) override;
|
|
void read_value(const char *id, size_t index, long long int &value) override;
|
|
void read_value(const char *id, size_t index, unsigned char &value) override;
|
|
void read_value(const char *id, size_t index, unsigned short &value) override;
|
|
void read_value(const char *id, size_t index, unsigned int &value) override;
|
|
void read_value(const char *id, size_t index, unsigned long &value) override;
|
|
void read_value(const char *id, size_t index, unsigned long long int &value) override;
|
|
void read_value(const char *id, size_t index, bool &value) override;
|
|
void read_value(const char *id, size_t index, float &value) override;
|
|
void read_value(const char *id, size_t index, double &value) override;
|
|
void read_value(const char *id, size_t index, char *value, size_t size) override;
|
|
void read_value(const char *id, size_t index, std::string &value) override;
|
|
void read_value(const char *id, size_t index, std::string &value, size_t s) override;
|
|
void read_value(const char *id, size_t index, sql::any_type &value, sql::data_type_t type, size_t size) override;
|
|
|
|
private:
|
|
rows result_;
|
|
long long row_index_ = -1;
|
|
size_t column_count_{};
|
|
};
|
|
|
|
}
|
|
|
|
#endif //QUERY_SQLITE_RESULT_READER_HPP
|