blob: f4dac121946759313e6f57aaa6ac0c3929e1a16d (
plain) (
blame)
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
|
using Sqlite;
namespace Qlite {
public abstract class StatementBuilder {
protected Database db;
internal StatementBuilder(Database db) {
this.db = db;
}
internal abstract Statement prepare();
internal abstract class AbstractField<T> {
public T value;
public Column<T>? column;
public AbstractField(T value) {
this.value = value;
}
internal abstract void bind(Statement stmt, int index);
}
internal class Field<T> : AbstractField<T> {
public Field(Column<T> column, T value) {
base(value);
this.column = column;
}
internal override void bind(Statement stmt, int index) {
((!)column).bind(stmt, index, value);
}
}
internal class NullField<T> : AbstractField<T> {
public NullField(Column<T> column) {
base(null);
this.column = column;
}
internal override void bind(Statement stmt, int index) {
stmt.bind_null(index);
}
}
internal class StringField : AbstractField<string> {
public StringField(string value) {
base(value);
}
internal override void bind(Statement stmt, int index) {
stmt.bind_text(index, value);
}
}
}
}
|