summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Judsen Hembree2024-12-13 23:40:08 -0500
committerGravatar GitHub2024-12-13 23:40:08 -0500
commit8fe3f3c2595679941c2c609dbe18e8ed5da779ab (patch)
tree2c9e148646aa3e5248e82489638c1e5f057c76e7
parentfixup README.md (diff)
downloadzig-sqlite-8fe3f3c2595679941c2c609dbe18e8ed5da779ab.tar.gz
zig-sqlite-8fe3f3c2595679941c2c609dbe18e8ed5da779ab.tar.xz
zig-sqlite-8fe3f3c2595679941c2c609dbe18e8ed5da779ab.zip
Update README.md
Use suggested code edit. Co-authored-by: Vincent Rischmann <vincent@rischmann.fr>
Diffstat (limited to '')
-rw-r--r--README.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/README.md b/README.md
index 4454e9c..07a9845 100644
--- a/README.md
+++ b/README.md
@@ -228,7 +228,9 @@ const row = try stmt.one(
228 .{ .id = 20 }, 228 .{ .id = 20 },
229); 229);
230if (row) |r| { 230if (row) |r| {
231 std.log.debug("name: {}, age: {}", .{std.mem.span((&row.name).ptr), row.age}); 231 const name_ptr: [*:0]const u8 = &r.name;
232 std.log.debug("name: {s}, age: {}", .{ std.mem.span(name_ptr), r.age });
233}
232} 234}
233``` 235```
234Notice that to read text we need to use a 0-terminated array; if the `name` column is bigger than 127 bytes the call to `one` will fail. 236Notice that to read text we need to use a 0-terminated array; if the `name` column is bigger than 127 bytes the call to `one` will fail.