summaryrefslogtreecommitdiff
path: root/libpqpp/pq-cursorselectcommand.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 14:34:16 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 14:40:20 +0100
commitedddd401b6a658613fd5058b6ba0fad30813402d (patch)
tree228efaa682b23f1b0f6821efae7d298ffe65fe1a /libpqpp/pq-cursorselectcommand.h
parentDon't attempt to close cursors when in failed transaction (it's failed and re... (diff)
downloadlibdbpp-postgresql-edddd401b6a658613fd5058b6ba0fad30813402d.tar.bz2
libdbpp-postgresql-edddd401b6a658613fd5058b6ba0fad30813402d.tar.xz
libdbpp-postgresql-edddd401b6a658613fd5058b6ba0fad30813402d.zip
Rename SelectCommand to CursorSelectCommand
Diffstat (limited to 'libpqpp/pq-cursorselectcommand.h')
-rw-r--r--libpqpp/pq-cursorselectcommand.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/libpqpp/pq-cursorselectcommand.h b/libpqpp/pq-cursorselectcommand.h
new file mode 100644
index 0000000..aafe4e1
--- /dev/null
+++ b/libpqpp/pq-cursorselectcommand.h
@@ -0,0 +1,40 @@
+#ifndef PQ_CURSORSELECTCOMMAND_H
+#define PQ_CURSORSELECTCOMMAND_H
+
+#include <selectcommand.h>
+#include "pq-command.h"
+#include <vector>
+#include <map>
+
+namespace PQ {
+ class Connection;
+ class Column;
+ class CursorSelectCommand : public DB::SelectCommand, public Command {
+ public:
+ CursorSelectCommand(Connection *, const std::string & sql, unsigned int no);
+ virtual ~CursorSelectCommand();
+
+ bool fetch() override;
+ void execute() override;
+
+ private:
+ void fetchTuples();
+ std::string mkdeclare() const;
+ std::string mkfetch() const;
+ std::string mkclose() const;
+
+ mutable bool executed;
+ mutable bool txOpened;
+ int nTuples, tuple, fTuples;
+ PGresult * execRes;
+ std::string s_declare;
+ std::string s_fetch;
+ std::string s_close;
+
+ friend class Column;
+ };
+}
+
+#endif
+
+