summaryrefslogtreecommitdiff
path: root/lib/dbConn.h
blob: 3f14dcbe9625028ba083baf83403ecd4f93ddd91 (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
#ifndef MYGRATE_DBCONN_H
#define MYGRATE_DBCONN_H

#include <dbRecordSet.h>
#include <dbTypes.h>
#include <initializer_list>

namespace MyGrate {
	class DbPrepStmt {
	public:
		virtual ~DbPrepStmt() = default;
		virtual void execute(const std::initializer_list<DbValue> &) = 0;
		virtual std::size_t rows() const = 0;
		virtual RecordSetPtr recordSet() = 0;
	};
	using DbPrepStmtPtr = std::unique_ptr<DbPrepStmt>;

	enum class ParamMode { None, DollarNum, QMark };

	class DbConn {
	public:
		virtual ~DbConn() = default;
		virtual void query(const char * const) = 0;
		virtual void query(const char * const, const std::initializer_list<DbValue> &) = 0;

		virtual DbPrepStmtPtr prepare(const char * const, std::size_t nParams) = 0;
	};
}

#endif