diff options
| author | 2024-12-13 23:40:08 -0500 | |
|---|---|---|
| committer | 2024-12-13 23:40:08 -0500 | |
| commit | 8fe3f3c2595679941c2c609dbe18e8ed5da779ab (patch) | |
| tree | 2c9e148646aa3e5248e82489638c1e5f057c76e7 /README.md | |
| parent | fixup README.md (diff) | |
| download | zig-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 'README.md')
| -rw-r--r-- | README.md | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -228,7 +228,9 @@ const row = try stmt.one( | |||
| 228 | .{ .id = 20 }, | 228 | .{ .id = 20 }, |
| 229 | ); | 229 | ); |
| 230 | if (row) |r| { | 230 | if (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 | ``` |
| 234 | Notice 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. | 236 | Notice 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. |