-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSqlite.h
More file actions
56 lines (47 loc) · 1.1 KB
/
Sqlite.h
File metadata and controls
56 lines (47 loc) · 1.1 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <string>
#include <ostream>
#include "sqlite3.h"
#include <map>
#include <string>
#include <vector>
// Forward declaration
class Sqlite;
class Cursor;
namespace gamzia
{
class Cursor
{
public:
Cursor(sqlite3 *db);
~Cursor();
bool execute(std::string sql);
bool execute(std::string sql, const std::vector<std::string> params);
std::vector<std::string> fetchOne();
std::vector<std::string> fetchAll();
std::vector<std::string> getColumnNames();
bool doesTableExist(std::string table);
bool commit();
bool rollback();
bool vacuum();
private:
sqlite3 *mydb;
sqlite3_stmt *statement;
};
class Sqlite
{
public:
Sqlite();
Sqlite(std::string dbname);
~Sqlite();
bool connect();
void close();
std::string getLastError();
Cursor getCursor();
private:
std::string mydbname;
sqlite3 *mydb;
bool isConnected;
std::string myerror;
}; // class
}; // Namespace