forked from six-ddc/sql-builder
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadapter.hpp
41 lines (33 loc) · 789 Bytes
/
adapter.hpp
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
34
35
36
37
38
39
40
41
#pragma once
#include <memory>
#include <string>
namespace boosql {
class adapter : public std::enable_shared_from_this<adapter>
{
public:
virtual std::string quote_value(const std::string & value) = 0;
virtual std::string quote_field(const std::string & field) = 0;
virtual std::string placeholder() = 0;
virtual adapter * clone() = 0;
};
class sqlite_adapter : public adapter
{
public:
std::string quote_value(const std::string & value) override
{
return "'" + value + "'";
}
std::string quote_field(const std::string & field) override
{
return "\"" + field + "\"";
}
std::string placeholder() override
{
return "?";
}
adapter * clone() override
{
return new sqlite_adapter();
}
};
}