summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2021-10-23 14:24:19 +0200
committerGravatar Vincent Rischmann2021-10-23 16:48:06 +0200
commit78fea7eda5163140d3b084c761621afef0d074e2 (patch)
tree13496205990ec36dc274ee87f9e35fdae8be1e7a
parentrename id_type/IdType for naming consistency (diff)
downloadzig-sqlite-78fea7eda5163140d3b084c761621afef0d074e2.tar.gz
zig-sqlite-78fea7eda5163140d3b084c761621afef0d074e2.tar.xz
zig-sqlite-78fea7eda5163140d3b084c761621afef0d074e2.zip
document BindMarker
-rw-r--r--query.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/query.zig b/query.zig
index 36f2d8e..6d9c4eb 100644
--- a/query.zig
+++ b/query.zig
@@ -8,8 +8,15 @@ const Blob = @import("sqlite.zig").Blob;
8pub const Text = struct { data: []const u8 }; 8pub const Text = struct { data: []const u8 };
9 9
10const BindMarker = struct { 10const BindMarker = struct {
11 typed: ?type = null, // null == untyped 11 /// Contains the expected type for a bind parameter which will be checked
12 /// at comptime when calling bind on a statement.
13 ///
14 /// A null means the bind parameter is untyped so there won't be comptime checking.
15 typed: ?type = null,
16
17 /// Contains the bind parameter identifier string.
12 identifier: ?[]const u8 = null, 18 identifier: ?[]const u8 = null,
19 /// Contains the type of the identifier which is either an integer or a string.
13 identifier_type: IdentifierType = .Integer, 20 identifier_type: IdentifierType = .Integer,
14 21
15 pub const IdentifierType = enum { 22 pub const IdentifierType = enum {
@@ -59,7 +66,7 @@ pub const ParsedQuery = struct {
59 }, 66 },
60 }, 67 },
61 .BindMarker => switch (c) { 68 .BindMarker => switch (c) {
62 '?', ':', '@', '$' => @compileError("unregconised multiple '?', ':', '$' or '@'."), 69 '?', ':', '@', '$' => @compileError("invalid multiple '?', ':', '$' or '@'."),
63 '{' => { 70 '{' => {
64 state = .BindMarkerType; 71 state = .BindMarkerType;
65 }, 72 },