diff options
Diffstat (limited to '')
| -rw-r--r-- | sqlite.zig | 17 |
1 files changed, 17 insertions, 0 deletions
| @@ -14,6 +14,23 @@ usingnamespace @import("error.zig"); | |||
| 14 | 14 | ||
| 15 | const logger = std.log.scoped(.sqlite); | 15 | const logger = std.log.scoped(.sqlite); |
| 16 | 16 | ||
| 17 | /// ZeroBlob is a blob with a fixed length containing only zeroes. | ||
| 18 | /// | ||
| 19 | /// A ZeroBlob is intended to serve as a placeholder; content can later be written with incremental i/o. | ||
| 20 | /// | ||
| 21 | /// Here is an example allowing you to write up to 1024 bytes to a blob with incremental i/o. | ||
| 22 | /// | ||
| 23 | /// try db.exec("INSERT INTO user VALUES(1, ?)", .{}, .{sqlite.ZeroBlob{ .length = 1024 }}); | ||
| 24 | /// const row_id = db.getLastInsertRowID(); | ||
| 25 | /// | ||
| 26 | /// var blob = try db.openBlob(.main, "user", "data", row_id, .{ .write = true }); | ||
| 27 | /// | ||
| 28 | /// var blob_writer = blob.writer(); | ||
| 29 | /// try blob_writer.writeAll("foobar"); | ||
| 30 | /// | ||
| 31 | /// try blob.close(); | ||
| 32 | /// | ||
| 33 | /// Search for "zeroblob" on https://sqlite.org/c3ref/blob_open.html for more details. | ||
| 17 | pub const ZeroBlob = struct { | 34 | pub const ZeroBlob = struct { |
| 18 | length: usize, | 35 | length: usize, |
| 19 | }; | 36 | }; |