From a948faa6790b3b694f6f6098936f2045c183f932 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sat, 14 Dec 2024 01:33:55 +0100 Subject: readme: fix examples --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'README.md') 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 var stmt = try db.prepare("SELECT id FROM user WHERE age > ? AND age < ? AND weight > ?{usize}"); defer stmt.deinit(); +const allocator = std.heap.page_allocator; // Use a suitable allocator + const rows = try stmt.all(usize, allocator, .{}, .{ .age_1 = 10, .age_2 = 20, @@ -567,7 +569,9 @@ To finish our example, passing the proper type allows it compile: var stmt = try db.prepare("SELECT id FROM user WHERE age > ? AND age < ? AND weight > ?{usize}"); defer stmt.deinit(); -const rows = try stmt.all(usize, .{}, .{ +const allocator = std.heap.page_allocator; // Use a suitable allocator + +const rows = try stmt.all(usize, allocator, .{}, .{ .age_1 = 10, .age_2 = 20, .weight = @as(usize, 200), -- cgit v1.2.3