diff options
Diffstat (limited to 'sqlite.zig')
| -rw-r--r-- | sqlite.zig | 8 |
1 files changed, 7 insertions, 1 deletions
| @@ -37,7 +37,7 @@ pub const Db = struct { | |||
| 37 | pub fn init(self: *Self, allocator: *mem.Allocator, options: anytype) !void { | 37 | pub fn init(self: *Self, allocator: *mem.Allocator, options: anytype) !void { |
| 38 | self.allocator = allocator; | 38 | self.allocator = allocator; |
| 39 | 39 | ||
| 40 | const mode = if (@hasField(@TypeOf(options), "mode")) options.mode else .Memory; | 40 | const mode: Mode = if (@hasField(@TypeOf(options), "mode")) options.mode else .Memory; |
| 41 | 41 | ||
| 42 | switch (mode) { | 42 | switch (mode) { |
| 43 | .File => |path| { | 43 | .File => |path| { |
| @@ -386,6 +386,12 @@ pub const Statement = struct { | |||
| 386 | } | 386 | } |
| 387 | }; | 387 | }; |
| 388 | 388 | ||
| 389 | test "sqlite: db init" { | ||
| 390 | var db: Db = undefined; | ||
| 391 | try db.init(testing.allocator, .{ .mode = dbMode() }); | ||
| 392 | try db.init(testing.allocator, .{}); | ||
| 393 | } | ||
| 394 | |||
| 389 | test "sqlite: statement exec" { | 395 | test "sqlite: statement exec" { |
| 390 | var arena = std.heap.ArenaAllocator.init(testing.allocator); | 396 | var arena = std.heap.ArenaAllocator.init(testing.allocator); |
| 391 | defer arena.deinit(); | 397 | defer arena.deinit(); |