From d96ca64c5d5402765eb217c35f1ecab4b6edd89c Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sat, 24 Oct 2020 23:16:03 +0200 Subject: sqlite: fix default mode --- sqlite.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sqlite.zig') diff --git a/sqlite.zig b/sqlite.zig index 88888cf..8aaef3a 100644 --- a/sqlite.zig +++ b/sqlite.zig @@ -37,7 +37,7 @@ pub const Db = struct { pub fn init(self: *Self, allocator: *mem.Allocator, options: anytype) !void { self.allocator = allocator; - const mode = if (@hasField(@TypeOf(options), "mode")) options.mode else .Memory; + const mode: Mode = if (@hasField(@TypeOf(options), "mode")) options.mode else .Memory; switch (mode) { .File => |path| { @@ -386,6 +386,12 @@ pub const Statement = struct { } }; +test "sqlite: db init" { + var db: Db = undefined; + try db.init(testing.allocator, .{ .mode = dbMode() }); + try db.init(testing.allocator, .{}); +} + test "sqlite: statement exec" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); -- cgit v1.2.3