diff options
| author | 2024-12-14 10:57:05 +0100 | |
|---|---|---|
| committer | 2024-12-14 10:57:05 +0100 | |
| commit | 97811f252fb4b019bd87e1cc814b7a9c167a416e (patch) | |
| tree | 93a2df911af7bef958a62821cf757436153b30db | |
| parent | readme: fix examples (diff) | |
| parent | Update README.md (diff) | |
| download | zig-sqlite-97811f252fb4b019bd87e1cc814b7a9c167a416e.tar.gz zig-sqlite-97811f252fb4b019bd87e1cc814b7a9c167a416e.tar.xz zig-sqlite-97811f252fb4b019bd87e1cc814b7a9c167a416e.zip | |
Merge pull request #172 from JudsenAtFlexgen/Documentation-update
fixup README.md
| -rw-r--r-- | README.md | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -230,8 +230,10 @@ const row = try stmt.one( | |||
| 230 | .{}, | 230 | .{}, |
| 231 | .{ .id = 20 }, | 231 | .{ .id = 20 }, |
| 232 | ); | 232 | ); |
| 233 | if (row) |row| { | 233 | if (row) |r| { |
| 234 | std.log.debug("name: {}, age: {}", .{std.mem.spanZ(&row.name), row.age}); | 234 | const name_ptr: [*:0]const u8 = &r.name; |
| 235 | std.log.debug("name: {s}, age: {}", .{ std.mem.span(name_ptr), r.age }); | ||
| 236 | } | ||
| 235 | } | 237 | } |
| 236 | ``` | 238 | ``` |
| 237 | 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. | 239 | 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. |