From 0f2f733b048bc6abdbd63937497fdf0051023b70 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Fri, 25 Jun 2021 18:04:20 +0200 Subject: fix 'unused function parameter' error --- sqlite.zig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sqlite.zig') diff --git a/sqlite.zig b/sqlite.zig index 143c279..975c6ef 100644 --- a/sqlite.zig +++ b/sqlite.zig @@ -243,6 +243,9 @@ pub const DetailedError = struct { message: []const u8, pub fn format(self: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { + _ = fmt; + _ = options; + _ = try writer.print("{{code: {}, message: {s}}}", .{ self.code, self.message }); } }; @@ -918,6 +921,8 @@ pub const StatementOptions = struct {}; /// Look at each function for more complete documentation. /// pub fn Statement(comptime opts: StatementOptions, comptime query: ParsedQuery) type { + _ = opts; + return struct { const Self = @This(); -- cgit v1.2.3 From 921df98109a84cacdd391d5abd30fd9af43b9a17 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Fri, 25 Jun 2021 18:04:43 +0200 Subject: fix 'redundant comptile' error --- sqlite.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sqlite.zig') diff --git a/sqlite.zig b/sqlite.zig index 975c6ef..3f43134 100644 --- a/sqlite.zig +++ b/sqlite.zig @@ -446,7 +446,7 @@ pub const Db = struct { } /// prepareWithDiags is like `prepare` but takes an additional options argument. - pub fn prepareWithDiags(self: *Self, comptime query: []const u8, options: QueryOptions) !comptime blk: { + pub fn prepareWithDiags(self: *Self, comptime query: []const u8, options: QueryOptions) !blk: { @setEvalBranchQuota(100000); break :blk Statement(.{}, ParsedQuery.from(query)); } { @@ -469,7 +469,7 @@ pub const Db = struct { /// This is done because we type check the bind parameters when executing the statement later. /// /// If you want additional error information in case of failures, use `prepareWithDiags`. - pub fn prepare(self: *Self, comptime query: []const u8) !comptime blk: { + pub fn prepare(self: *Self, comptime query: []const u8) !blk: { @setEvalBranchQuota(100000); break :blk Statement(.{}, ParsedQuery.from(query)); } { -- cgit v1.2.3 From c3579fa48ab8e814058242e14d3b9d0dc4ff68c2 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Fri, 25 Jun 2021 18:18:19 +0200 Subject: fix 'unused variable' errors --- sqlite.zig | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'sqlite.zig') diff --git a/sqlite.zig b/sqlite.zig index 3f43134..3c2471d 100644 --- a/sqlite.zig +++ b/sqlite.zig @@ -735,12 +735,6 @@ pub fn Iterator(comptime Type: type) type { // The options must contain an `allocator` field which will be used to create a copy of the data. fn readBytes(self: *Self, comptime BytesType: type, allocator: *mem.Allocator, _i: usize, comptime mode: ReadBytesMode) !BytesType { const i = @intCast(c_int, _i); - const type_info = @typeInfo(BytesType); - - var ret: BytesType = switch (BytesType) { - Text, Blob => .{ .data = "" }, - else => try dupeWithSentinel(BytesType, allocator, ""), - }; switch (mode) { .Blob => { @@ -1250,6 +1244,7 @@ fn addTestData(db: *Db) !void { test "sqlite: db init" { var db = try getTestDb(); + _ = db; } test "sqlite: db pragma" { -- cgit v1.2.3