blob: 87cd70fc0d854179a5018d752506252006d8417d (
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
34
35
|
#pragma once
#include <sqlite3.h>
class Statement
{
public:
Statement(sqlite3_stmt* stmt):
stmt(stmt) {}
~Statement()
{
sqlite3_finalize(this->stmt);
}
Statement(const Statement&) = delete;
Statement& operator=(const Statement&) = delete;
Statement(Statement&& other):
stmt(other.stmt)
{
other.stmt = nullptr;
}
Statement& operator=(Statement&& other)
{
this->stmt = other.stmt;
other.stmt = nullptr;
return *this;
}
sqlite3_stmt* get()
{
return this->stmt;
}
private:
sqlite3_stmt* stmt;
};
|