diff options
Diffstat (limited to '')
| -rw-r--r-- | sqlite.zig | 9 |
1 files changed, 7 insertions, 2 deletions
| @@ -1444,7 +1444,8 @@ pub fn Iterator(comptime Type: type) type { | |||
| 1444 | } | 1444 | } |
| 1445 | @compileError("enum column " ++ @typeName(FieldType) ++ " must have a BaseType of either string or int"); | 1445 | @compileError("enum column " ++ @typeName(FieldType) ++ " must have a BaseType of either string or int"); |
| 1446 | }, | 1446 | }, |
| 1447 | .Struct => { | 1447 | .Struct => |TI| { |
| 1448 | if (TI.layout == .Packed) return @bitCast(FieldType, try self.readInt(TI.backing_integer.?, i)); | ||
| 1448 | const inner_value = try self.readField(FieldType.BaseType, options, i); | 1449 | const inner_value = try self.readField(FieldType.BaseType, options, i); |
| 1449 | return try FieldType.readField(options.allocator, inner_value); | 1450 | return try FieldType.readField(options.allocator, inner_value); |
| 1450 | }, | 1451 | }, |
| @@ -1650,7 +1651,11 @@ pub const DynamicStatement = struct { | |||
| 1650 | @compileError("enum column " ++ @typeName(FieldType) ++ " must have a BaseType of either string or int to bind"); | 1651 | @compileError("enum column " ++ @typeName(FieldType) ++ " must have a BaseType of either string or int to bind"); |
| 1651 | } | 1652 | } |
| 1652 | }, | 1653 | }, |
| 1653 | .Struct => { | 1654 | .Struct => |info| { |
| 1655 | if (info.layout == .Packed) { | ||
| 1656 | try self.bindField(info.backing_integer.?, options, field_name, i, @bitCast(info.backing_integer.?, field)); | ||
| 1657 | return; | ||
| 1658 | } | ||
| 1654 | if (!comptime std.meta.trait.hasFn("bindField")(FieldType)) { | 1659 | if (!comptime std.meta.trait.hasFn("bindField")(FieldType)) { |
| 1655 | @compileError("cannot bind field " ++ field_name ++ " of type " ++ @typeName(FieldType) ++ ", consider implementing the bindField() method"); | 1660 | @compileError("cannot bind field " ++ field_name ++ " of type " ++ @typeName(FieldType) ++ ", consider implementing the bindField() method"); |
| 1656 | } | 1661 | } |