diff options
| -rw-r--r-- | query.zig | 11 |
1 files changed, 9 insertions, 2 deletions
| @@ -8,8 +8,15 @@ const Blob = @import("sqlite.zig").Blob; | |||
| 8 | pub const Text = struct { data: []const u8 }; | 8 | pub const Text = struct { data: []const u8 }; |
| 9 | 9 | ||
| 10 | const BindMarker = struct { | 10 | const 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 | }, |