summaryrefslogtreecommitdiff
path: root/lib/input/mysqlStmt.h
blob: 69e62d4045aabb5a0186cab6d30e8842931f4972 (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
#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;

	private:
		StmtPtr stmt;
	};
}

#endif