summaryrefslogtreecommitdiff
path: root/lib/input/mysqlStmt.h
blob: 09b5c7351f1c3ce2860b2f6e10812f159dc4136b (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
33
#ifndef MYGRATE_INPUT_MYSQLSTMT_H
#define MYGRATE_INPUT_MYSQLSTMT_H

#include "dbConn.h"
#include "dbRecordSet.h"
#include <cstddef>
#include <initializer_list>
#include <memory>
#include <mysql.h>

namespace MyGrate {
	class DbValue;
}
namespace MyGrate::Input {
	using StmtPtr = std::unique_ptr<MYSQL_STMT, decltype(&mysql_stmt_close)>;

	class MySQLPrepStmt : public DbPrepStmt {
	public:
		MySQLPrepStmt(const char * const q, MYSQL * c);
		void execute(const std::initializer_list<DbValue> & vs) override;

		std::size_t rows() const override;

		RecordSetPtr recordSet() override;

		CursorPtr cursor() override;

	private:
		StmtPtr stmt;
	};
}

#endif