summaryrefslogtreecommitdiff
path: root/libpqpp/pq-cursorselectcommand.h
blob: 23798cdd956fe8d60697e2f6bcb9b2b8be5dea94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include "command_fwd.h"
#include "pq-command.h"
#include "pq-selectbase.h"
#include <c++11Helpers.h>
#include <string>

namespace PQ {
	class Connection;

	class CursorSelectCommand : public SelectBase, public Command {
	public:
		CursorSelectCommand(
				Connection *, const std::string & sql, const PQ::CommandOptionsCPtr &, const DB::CommandOptionsCPtr &);
		~CursorSelectCommand() override;
		SPECIAL_MEMBERS_DELETE(CursorSelectCommand);

		bool fetch() override;
		void execute() override;

	private:
		void fetchTuples();
		std::string mkdeclare() const;

		mutable bool executed;
		unsigned int fTuples;
		std::string s_declare;
		std::string s_fetch;
		std::string s_close;
	};
}