-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.h
More file actions
41 lines (28 loc) · 835 Bytes
/
database.h
File metadata and controls
41 lines (28 loc) · 835 Bytes
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
#ifndef DATABASE_H
#define DATABASE_H
#include "reference.h"
#include "sqlite3.h"
// TODO: Look into using UTF-16 in database
// TODO: Get sqlite to use godot memory allocation
class Database : public Reference {
friend class Statement;
OBJ_TYPE(Database, Reference);
sqlite3* mpDatabase;
protected:
static void _bind_methods();
public:
enum Mode {
MODE_OPEN_DEFAULT = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
MODE_OPEN_READONLY = SQLITE_OPEN_READONLY,
MODE_OPEN_READWRITE = SQLITE_OPEN_READWRITE,
MODE_OPEN_CREATE = SQLITE_OPEN_CREATE
};
Error open(const String& database_file, Mode mode_flags = MODE_OPEN_DEFAULT);
void close();
bool opened() const;
String getErrorMessage() const;
Database();
~Database();
};
VARIANT_ENUM_CAST(Database::Mode);
#endif