lintel 0.2.0
Loading...
Searching...
No Matches
Cursor.h
Go to the documentation of this file.
1#ifndef LINTEL_POSTGRESQL_CURSOR_H
2#define LINTEL_POSTGRESQL_CURSOR_H
3
4#include <libpq-fe.h>
5
6#include <atomic>
7#include <cstddef>
8#include <string>
9#include <vector>
10
12
13namespace lintel {
14namespace postgresql {
15 class Connection;
16
33 class Cursor
34 {
35 private:
36 PGconn *m_conn;
37 bool m_active;
38 bool m_serverSide;
46 bool m_ownsTransaction;
47 std::string m_cursorName;
48 std::size_t m_fetchSize;
49
53 void drain();
54
59 std::vector<db::Arguments> fetchFromServer(std::size_t maxRows);
60
64 void close();
65
66 public:
75 explicit Cursor(const Connection &connection, const std::string &query, const std::vector<std::string> &params);
76
87 explicit Cursor(const Connection &connection,
88 const std::string &query,
89 const std::vector<std::string> &params,
90 std::size_t fetchSize,
91 const std::string &cursorName,
92 bool noScroll);
93
94 Cursor(Cursor &cursor) = delete;
95
98
106 [[nodiscard]] std::vector<db::Arguments> fetchNext(std::size_t maxRows);
107 };
108}// namespace postgresql
109
110}// namespace lintel
111#endif// LINTEL_POSTGRESQL_CURSOR_H
Definition Connection.h:31
Definition Cursor.h:34
Cursor(const Connection &connection, const std::string &query, const std::vector< std::string > &params)
std::vector< db::Arguments > fetchNext(std::size_t maxRows)
Cursor(Cursor &cursor)=delete
Cursor(const Connection &connection, const std::string &query, const std::vector< std::string > &params, std::size_t fetchSize, const std::string &cursorName, bool noScroll)
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9