summaryrefslogtreecommitdiff
path: root/query.zig
diff options
context:
space:
mode:
authorGravatar Gracen2025-06-08 12:52:30 -0600
committerGravatar Gracen2025-06-08 12:52:30 -0600
commita813e5a975b5767ab6ea6d7756142b4c716c48f0 (patch)
tree11a1f297b139c485baf17d09de68d69259e3b5ae /query.zig
parentfix bug from previous commit, zig doesn't look ahead for type inference (diff)
downloadzig-sqlite-a813e5a975b5767ab6ea6d7756142b4c716c48f0.tar.gz
zig-sqlite-a813e5a975b5767ab6ea6d7756142b4c716c48f0.tar.xz
zig-sqlite-a813e5a975b5767ab6ea6d7756142b4c716c48f0.zip
add test case, switch from using a nullable to undefined
Diffstat (limited to 'query.zig')
-rw-r--r--query.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/query.zig b/query.zig
index 80d8981..3f33e08 100644
--- a/query.zig
+++ b/query.zig
@@ -56,7 +56,7 @@ pub fn ParsedQuery(comptime tmp_query: []const u8) type {
56 // This holds the starting character of the string while 56 // This holds the starting character of the string while
57 // state is .inside_string so that we know which type of 57 // state is .inside_string so that we know which type of
58 // string we're exiting from 58 // string we're exiting from
59 var string_starting_character: ?u8 = null; 59 var string_starting_character: u8 = undefined;
60 60
61 var current_bind_marker_type: [256]u8 = undefined; 61 var current_bind_marker_type: [256]u8 = undefined;
62 var current_bind_marker_type_pos = 0; 62 var current_bind_marker_type_pos = 0;
@@ -452,6 +452,11 @@ test "parsed query: bind marker character inside string" {
452 .exp_bind_markers = 1, 452 .exp_bind_markers = 1,
453 .exp = "SELECT json_extract(metadata, '$.name') AS name FROM foobar WHERE name = $name", 453 .exp = "SELECT json_extract(metadata, '$.name') AS name FROM foobar WHERE name = $name",
454 }, 454 },
455 .{
456 .query = "SELECT json_extract(metadata, '$[0]') AS name FROM foobar",
457 .exp_bind_markers = 0,
458 .exp = "SELECT json_extract(metadata, '$[0]') AS name FROM foobar",
459 },
455 }; 460 };
456 461
457 inline for (testCases) |tc| { 462 inline for (testCases) |tc| {