diff options
| author | 2022-04-21 23:00:42 +0200 | |
|---|---|---|
| committer | 2022-04-21 23:00:42 +0200 | |
| commit | 8d8b3270dcc33bcb910e2a7d401b1054f7d98b00 (patch) | |
| tree | 7a1c9c747ac50cff222b1b13cf4bab13d38b8e9b | |
| parent | cleanup the temporary values correctly for enums (diff) | |
| download | zig-sqlite-8d8b3270dcc33bcb910e2a7d401b1054f7d98b00.tar.gz zig-sqlite-8d8b3270dcc33bcb910e2a7d401b1054f7d98b00.tar.xz zig-sqlite-8d8b3270dcc33bcb910e2a7d401b1054f7d98b00.zip | |
readme: add note about allocator for custom types
| -rw-r--r-- | README.md | 5 |
1 files changed, 5 insertions, 0 deletions
| @@ -451,6 +451,11 @@ Now when you bind a value of type `MyArray` the value returned by `bindField` wi | |||
| 451 | 451 | ||
| 452 | Same for reading, when you select _into_ a `MyArray` row or field the value returned by `readField` will be used instead. | 452 | Same for reading, when you select _into_ a `MyArray` row or field the value returned by `readField` will be used instead. |
| 453 | 453 | ||
| 454 | _NOTE_: when you _do_ allocate in `bindField` or `readField` make sure to pass a `std.heap.ArenaAllocator`-based allocator. | ||
| 455 | |||
| 456 | The binding or reading code does not keep tracking of allocations made in custom types so it can't free the allocated data itself; it's therefore required | ||
| 457 | to use an arena to prevent memory leaks. | ||
| 458 | |||
| 454 | # Comptime checks | 459 | # Comptime checks |
| 455 | 460 | ||
| 456 | Prepared statements contain _comptime_ metadata which is used to validate every call to `exec`, `one` and `all` _at compile time_. | 461 | Prepared statements contain _comptime_ metadata which is used to validate every call to `exec`, `one` and `all` _at compile time_. |