diff options
| -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. |