summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2024-12-14 01:33:55 +0100
committerGravatar Vincent Rischmann2024-12-14 01:33:55 +0100
commita948faa6790b3b694f6f6098936f2045c183f932 (patch)
treed8505d044f4845cb096c651853714fce02d5b71a
parentreadme: fix examples (diff)
downloadzig-sqlite-a948faa6790b3b694f6f6098936f2045c183f932.tar.gz
zig-sqlite-a948faa6790b3b694f6f6098936f2045c183f932.tar.xz
zig-sqlite-a948faa6790b3b694f6f6098936f2045c183f932.zip
readme: fix examples
-rw-r--r--README.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/README.md b/README.md
index 4938f76..05182a0 100644
--- a/README.md
+++ b/README.md
@@ -523,6 +523,8 @@ We can make sure the bind parameters have the right type if we rewrite the query
523var stmt = try db.prepare("SELECT id FROM user WHERE age > ? AND age < ? AND weight > ?{usize}"); 523var stmt = try db.prepare("SELECT id FROM user WHERE age > ? AND age < ? AND weight > ?{usize}");
524defer stmt.deinit(); 524defer stmt.deinit();
525 525
526const allocator = std.heap.page_allocator; // Use a suitable allocator
527
526const rows = try stmt.all(usize, allocator, .{}, .{ 528const rows = try stmt.all(usize, allocator, .{}, .{
527 .age_1 = 10, 529 .age_1 = 10,
528 .age_2 = 20, 530 .age_2 = 20,
@@ -567,7 +569,9 @@ To finish our example, passing the proper type allows it compile:
567var stmt = try db.prepare("SELECT id FROM user WHERE age > ? AND age < ? AND weight > ?{usize}"); 569var stmt = try db.prepare("SELECT id FROM user WHERE age > ? AND age < ? AND weight > ?{usize}");
568defer stmt.deinit(); 570defer stmt.deinit();
569 571
570const rows = try stmt.all(usize, .{}, .{ 572const allocator = std.heap.page_allocator; // Use a suitable allocator
573
574const rows = try stmt.all(usize, allocator, .{}, .{
571 .age_1 = 10, 575 .age_1 = 10,
572 .age_2 = 20, 576 .age_2 = 20,
573 .weight = @as(usize, 200), 577 .weight = @as(usize, 200),