diff options
| author | 2025-01-06 12:38:49 -0600 | |
|---|---|---|
| committer | 2025-01-06 12:38:49 -0600 | |
| commit | 1c6938b2d28e8a758b8777aac5242ac2ef36f284 (patch) | |
| tree | 63a0fe1d11d393fa2db775b59836f9ce2b112b1d | |
| parent | build: the 'bundled' flag is useless (diff) | |
| download | zig-sqlite-1c6938b2d28e8a758b8777aac5242ac2ef36f284.tar.gz zig-sqlite-1c6938b2d28e8a758b8777aac5242ac2ef36f284.tar.xz zig-sqlite-1c6938b2d28e8a758b8777aac5242ac2ef36f284.zip | |
zig: remove workaround for ziglang#5149
error.Workaround was being returned due to
https://github.com/ziglang/zig/issues/5149. This has been fixed. Remove
the error and todo items
Diffstat (limited to '')
| -rw-r--r-- | sqlite.zig | 24 |
1 files changed, 12 insertions, 12 deletions
| @@ -1070,15 +1070,15 @@ pub fn Iterator(comptime Type: type) type { | |||
| 1070 | switch (TypeInfo) { | 1070 | switch (TypeInfo) { |
| 1071 | .int => { | 1071 | .int => { |
| 1072 | debug.assert(columns == 1); | 1072 | debug.assert(columns == 1); |
| 1073 | return try self.readInt(Type, 0); | 1073 | return self.readInt(Type, 0); |
| 1074 | }, | 1074 | }, |
| 1075 | .float => { | 1075 | .float => { |
| 1076 | debug.assert(columns == 1); | 1076 | debug.assert(columns == 1); |
| 1077 | return try self.readFloat(Type, 0); | 1077 | return self.readFloat(Type, 0); |
| 1078 | }, | 1078 | }, |
| 1079 | .bool => { | 1079 | .bool => { |
| 1080 | debug.assert(columns == 1); | 1080 | debug.assert(columns == 1); |
| 1081 | return try self.readBool(0); | 1081 | return self.readBool(0); |
| 1082 | }, | 1082 | }, |
| 1083 | .void => { | 1083 | .void => { |
| 1084 | debug.assert(columns == 1); | 1084 | debug.assert(columns == 1); |
| @@ -1144,15 +1144,15 @@ pub fn Iterator(comptime Type: type) type { | |||
| 1144 | switch (TypeInfo) { | 1144 | switch (TypeInfo) { |
| 1145 | .int => { | 1145 | .int => { |
| 1146 | debug.assert(columns == 1); | 1146 | debug.assert(columns == 1); |
| 1147 | return try self.readInt(Type, 0); | 1147 | return self.readInt(Type, 0); |
| 1148 | }, | 1148 | }, |
| 1149 | .float => { | 1149 | .float => { |
| 1150 | debug.assert(columns == 1); | 1150 | debug.assert(columns == 1); |
| 1151 | return try self.readFloat(Type, 0); | 1151 | return self.readFloat(Type, 0); |
| 1152 | }, | 1152 | }, |
| 1153 | .bool => { | 1153 | .bool => { |
| 1154 | debug.assert(columns == 1); | 1154 | debug.assert(columns == 1); |
| 1155 | return try self.readBool(0); | 1155 | return self.readBool(0); |
| 1156 | }, | 1156 | }, |
| 1157 | .void => { | 1157 | .void => { |
| 1158 | debug.assert(columns == 1); | 1158 | debug.assert(columns == 1); |
| @@ -1242,19 +1242,19 @@ pub fn Iterator(comptime Type: type) type { | |||
| 1242 | } | 1242 | } |
| 1243 | 1243 | ||
| 1244 | // readInt reads a sqlite INTEGER column into an integer. | 1244 | // readInt reads a sqlite INTEGER column into an integer. |
| 1245 | fn readInt(self: *Self, comptime IntType: type, i: usize) error{Workaround}!IntType { // TODO remove the workaround once https://github.com/ziglang/zig/issues/5149 is resolved or if we actually return an error | 1245 | fn readInt(self: *Self, comptime IntType: type, i: usize) IntType { |
| 1246 | const n = c.sqlite3_column_int64(self.stmt, @intCast(i)); | 1246 | const n = c.sqlite3_column_int64(self.stmt, @intCast(i)); |
| 1247 | return @intCast(n); | 1247 | return @intCast(n); |
| 1248 | } | 1248 | } |
| 1249 | 1249 | ||
| 1250 | // readFloat reads a sqlite REAL column into a float. | 1250 | // readFloat reads a sqlite REAL column into a float. |
| 1251 | fn readFloat(self: *Self, comptime FloatType: type, i: usize) error{Workaround}!FloatType { // TODO remove the workaround once https://github.com/ziglang/zig/issues/5149 is resolved or if we actually return an error | 1251 | fn readFloat(self: *Self, comptime FloatType: type, i: usize) FloatType { |
| 1252 | const d = c.sqlite3_column_double(self.stmt, @intCast(i)); | 1252 | const d = c.sqlite3_column_double(self.stmt, @intCast(i)); |
| 1253 | return @floatCast(d); | 1253 | return @floatCast(d); |
| 1254 | } | 1254 | } |
| 1255 | 1255 | ||
| 1256 | // readFloat reads a sqlite INTEGER column into a bool (true is anything > 0, false is anything <= 0). | 1256 | // readFloat reads a sqlite INTEGER column into a bool (true is anything > 0, false is anything <= 0). |
| 1257 | fn readBool(self: *Self, i: usize) error{Workaround}!bool { // TODO remove the workaround once https://github.com/ziglang/zig/issues/5149 is resolved or if we actually return an error | 1257 | fn readBool(self: *Self, i: usize) bool { |
| 1258 | const d = c.sqlite3_column_int64(self.stmt, @intCast(i)); | 1258 | const d = c.sqlite3_column_int64(self.stmt, @intCast(i)); |
| 1259 | return d > 0; | 1259 | return d > 0; |
| 1260 | } | 1260 | } |
| @@ -1450,9 +1450,9 @@ pub fn Iterator(comptime Type: type) type { | |||
| 1450 | break :blk try self.readBytes(Text, options.allocator, i, .Text); | 1450 | break :blk try self.readBytes(Text, options.allocator, i, .Text); |
| 1451 | }, | 1451 | }, |
| 1452 | else => switch (field_type_info) { | 1452 | else => switch (field_type_info) { |
| 1453 | .int => try self.readInt(FieldType, i), | 1453 | .int => self.readInt(FieldType, i), |
| 1454 | .float => try self.readFloat(FieldType, i), | 1454 | .float => self.readFloat(FieldType, i), |
| 1455 | .bool => try self.readBool(i), | 1455 | .bool => self.readBool(i), |
| 1456 | .void => {}, | 1456 | .void => {}, |
| 1457 | .array => try self.readArray(FieldType, i), | 1457 | .array => try self.readArray(FieldType, i), |
| 1458 | .pointer => try self.readPointer(FieldType, options, i), | 1458 | .pointer => try self.readPointer(FieldType, options, i), |