summaryrefslogtreecommitdiff
path: root/sqlite.zig
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2021-12-31 01:56:10 +0100
committerGravatar Vincent Rischmann2021-12-31 01:56:10 +0100
commit2b58344a8b36c4aebdfdc60b55c95b432fc8842d (patch)
tree65a6f8035ed53a8f84d7fc8c21d62ec6a4da0ce5 /sqlite.zig
parentfix query parsing when there's a named identifier without a type (diff)
downloadzig-sqlite-2b58344a8b36c4aebdfdc60b55c95b432fc8842d.tar.gz
zig-sqlite-2b58344a8b36c4aebdfdc60b55c95b432fc8842d.tar.xz
zig-sqlite-2b58344a8b36c4aebdfdc60b55c95b432fc8842d.zip
add a test using untyped bind markers
Diffstat (limited to '')
-rw-r--r--sqlite.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/sqlite.zig b/sqlite.zig
index 6851aee..0eca84c 100644
--- a/sqlite.zig
+++ b/sqlite.zig
@@ -3137,6 +3137,25 @@ test "sqlite: oneDynamic" {
3137 } 3137 }
3138} 3138}
3139 3139
3140test "sqlite: one with all named parameters" {
3141 var db = try getTestDb();
3142 defer db.deinit();
3143 try addTestData(&db);
3144
3145 var diags = Diagnostics{};
3146
3147 // Mix bind marker prefix for good measure
3148
3149 const id = try db.one(
3150 usize,
3151 "SELECT id FROM user WHERE age = $age AND weight < :weight and id < @id",
3152 .{ .diags = &diags },
3153 .{ .id = 400, .age = 33, .weight = 200 },
3154 );
3155 try testing.expect(id != null);
3156 try testing.expectEqual(@as(usize, 20), id.?);
3157}
3158
3140test "sqlite: empty slice" { 3159test "sqlite: empty slice" {
3141 var arena = std.heap.ArenaAllocator.init(testing.allocator); 3160 var arena = std.heap.ArenaAllocator.init(testing.allocator);
3142 defer arena.deinit(); 3161 defer arena.deinit();