diff options
Diffstat (limited to '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. |