diff options
| author | 2020-10-29 20:28:20 +0100 | |
|---|---|---|
| committer | 2020-10-29 20:28:20 +0100 | |
| commit | 75f1a04943cdf06b66fc7f991b459c31ae23a6ac (patch) | |
| tree | 95411efbdf381c4e9ae71e37ca6426819c272f00 | |
| parent | Merge branch 'refactor-api' (diff) | |
| download | zig-sqlite-75f1a04943cdf06b66fc7f991b459c31ae23a6ac.tar.gz zig-sqlite-75f1a04943cdf06b66fc7f991b459c31ae23a6ac.tar.xz zig-sqlite-75f1a04943cdf06b66fc7f991b459c31ae23a6ac.zip | |
use an anonymous struct now that the compiler is fixed
| -rw-r--r-- | sqlite.zig | 11 |
1 files changed, 2 insertions, 9 deletions
| @@ -555,16 +555,9 @@ test "sqlite: statement exec" { | |||
| 555 | // Test with a Bytes struct | 555 | // Test with a Bytes struct |
| 556 | 556 | ||
| 557 | { | 557 | { |
| 558 | // NOTE(vincent): can't yet pass an anonymous struct, the compiler crashes. | 558 | try db.exec("INSERT INTO user(id, name, age) VALUES(?, ?, ?)", .{ |
| 559 | const Params = struct { | ||
| 560 | id: usize, | ||
| 561 | name: Bytes, | ||
| 562 | age: usize, | ||
| 563 | }; | ||
| 564 | |||
| 565 | try db.exec("INSERT INTO user(id, name, age) VALUES(?, ?, ?)", Params{ | ||
| 566 | .id = 200, | 559 | .id = 200, |
| 567 | .name = .{ .Text = "hello" }, | 560 | .name = Bytes{ .Text = "hello" }, |
| 568 | .age = 20, | 561 | .age = 20, |
| 569 | }); | 562 | }); |
| 570 | } | 563 | } |