From 0d766361474ae47a2f21464913e348702705cf4e Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Wed, 11 Nov 2020 14:13:31 +0100 Subject: allow untyped bind markers --- sqlite.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sqlite.zig') diff --git a/sqlite.zig b/sqlite.zig index 5dd6cdb..53e1a6a 100644 --- a/sqlite.zig +++ b/sqlite.zig @@ -202,8 +202,12 @@ pub fn Statement(comptime opts: StatementOptions, comptime query: ParsedQuery) t } inline for (StructTypeInfo.fields) |struct_field, _i| { - if (struct_field.field_type != query.bind_markers[_i].Type) { - @compileError("value type " ++ @typeName(struct_field.field_type) ++ " is not the bind marker type " ++ @typeName(query.bind_markers[_i].Type)); + const bind_marker = query.bind_markers[_i]; + switch (bind_marker) { + .Typed => |typ| if (struct_field.field_type != typ) { + @compileError("value type " ++ @typeName(struct_field.field_type) ++ " is not the bind marker type " ++ @typeName(typ)); + }, + .Untyped => {}, } const i = @as(usize, _i); -- cgit v1.2.3