-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatement.h
More file actions
59 lines (41 loc) · 1.2 KB
/
statement.h
File metadata and controls
59 lines (41 loc) · 1.2 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
57
58
59
#ifndef STATEMENT_H
#define STATEMENT_H
#include "reference.h"
#include "sqlite3.h"
class Database;
class Statement : public Reference {
OBJ_TYPE(Statement, Reference);
sqlite3_stmt* mpStatement;
protected:
static void _bind_methods();
public:
enum ReturnCode {
STEP_ROW = SQLITE_ROW,
STEP_DONE = SQLITE_DONE,
STEP_BUSY = SQLITE_BUSY,
STEP_MISUSE = SQLITE_MISUSE
};
enum GetMethod {
GET_BY_NAME,
GET_BY_INDEX,
GET_BY_BOTH
};
Error prepare(Ref<Database>& db, const String& statement);
void finalize();
String getSql() const;
int getParamCount() const;
String getParamName(int index) const;
int getParamIndex(const String& parameter_name) const;
Error bind(const Variant& index, const Variant& value);
ReturnCode step();
Dictionary getRow(GetMethod method = GET_BY_NAME) const;
Array getResults(GetMethod method = GET_BY_NAME);
int getColumnCount() const;
Variant getColumn(int column_index) const;
bool getColumnAsBool(int column_index); // Specifically not const as it can change the column type
Statement();
~Statement();
};
VARIANT_ENUM_CAST(Statement::ReturnCode);
VARIANT_ENUM_CAST(Statement::GetMethod);
#endif