diff options
| author | 2020-12-27 16:05:15 +0100 | |
|---|---|---|
| committer | 2020-12-27 16:05:26 +0100 | |
| commit | 94890021df0ccc1a4b16ddc6b8bcabd8d6be38ce (patch) | |
| tree | a826de2ddb66d3f42c1c6a04dd39f694b5507268 /sqlite.zig | |
| parent | require the callers to provide a 0-terminated string (diff) | |
| download | zig-sqlite-94890021df0ccc1a4b16ddc6b8bcabd8d6be38ce.tar.gz zig-sqlite-94890021df0ccc1a4b16ddc6b8bcabd8d6be38ce.tar.xz zig-sqlite-94890021df0ccc1a4b16ddc6b8bcabd8d6be38ce.zip | |
don't pass the options to readInt, readFloat, readBool
Diffstat (limited to 'sqlite.zig')
| -rw-r--r-- | sqlite.zig | 18 |
1 files changed, 9 insertions, 9 deletions
| @@ -218,15 +218,15 @@ pub fn Iterator(comptime Type: type) type { | |||
| 218 | switch (TypeInfo) { | 218 | switch (TypeInfo) { |
| 219 | .Int => { | 219 | .Int => { |
| 220 | debug.assert(columns == 1); | 220 | debug.assert(columns == 1); |
| 221 | return try self.readInt(Type, 0, options); | 221 | return try self.readInt(Type, 0); |
| 222 | }, | 222 | }, |
| 223 | .Float => { | 223 | .Float => { |
| 224 | debug.assert(columns == 1); | 224 | debug.assert(columns == 1); |
| 225 | return try self.readFloat(Type, 0, options); | 225 | return try self.readFloat(Type, 0); |
| 226 | }, | 226 | }, |
| 227 | .Bool => { | 227 | .Bool => { |
| 228 | debug.assert(columns == 1); | 228 | debug.assert(columns == 1); |
| 229 | return try self.readBool(0, options); | 229 | return try self.readBool(0); |
| 230 | }, | 230 | }, |
| 231 | .Void => { | 231 | .Void => { |
| 232 | debug.assert(columns == 1); | 232 | debug.assert(columns == 1); |
| @@ -285,19 +285,19 @@ pub fn Iterator(comptime Type: type) type { | |||
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | // readInt reads a sqlite INTEGER column into an integer. | 287 | // readInt reads a sqlite INTEGER column into an integer. |
| 288 | fn readInt(self: *Self, comptime IntType: type, i: usize, options: anytype) !IntType { | 288 | fn readInt(self: *Self, comptime IntType: type, i: usize) !IntType { |
| 289 | const n = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i)); | 289 | const n = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i)); |
| 290 | return @intCast(IntType, n); | 290 | return @intCast(IntType, n); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | // readFloat reads a sqlite REAL column into a float. | 293 | // readFloat reads a sqlite REAL column into a float. |
| 294 | fn readFloat(self: *Self, comptime FloatType: type, i: usize, options: anytype) !FloatType { | 294 | fn readFloat(self: *Self, comptime FloatType: type, i: usize) !FloatType { |
| 295 | const d = c.sqlite3_column_double(self.stmt, @intCast(c_int, i)); | 295 | const d = c.sqlite3_column_double(self.stmt, @intCast(c_int, i)); |
| 296 | return @floatCast(FloatType, d); | 296 | return @floatCast(FloatType, d); |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | // readFloat reads a sqlite INTEGER column into a bool (true is anything > 0, false is anything <= 0). | 299 | // readFloat reads a sqlite INTEGER column into a bool (true is anything > 0, false is anything <= 0). |
| 300 | fn readBool(self: *Self, i: usize, options: anytype) !bool { | 300 | fn readBool(self: *Self, i: usize) !bool { |
| 301 | const d = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i)); | 301 | const d = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i)); |
| 302 | return d > 0; | 302 | return d > 0; |
| 303 | } | 303 | } |
| @@ -436,9 +436,9 @@ pub fn Iterator(comptime Type: type) type { | |||
| 436 | Blob => try self.readBytes(Blob, i, .Blob, options), | 436 | Blob => try self.readBytes(Blob, i, .Blob, options), |
| 437 | Text => try self.readBytes(Text, i, .Text, options), | 437 | Text => try self.readBytes(Text, i, .Text, options), |
| 438 | else => switch (field_type_info) { | 438 | else => switch (field_type_info) { |
| 439 | .Int => try self.readInt(field.field_type, i, options), | 439 | .Int => try self.readInt(field.field_type, i), |
| 440 | .Float => try self.readFloat(field.field_type, i, options), | 440 | .Float => try self.readFloat(field.field_type, i), |
| 441 | .Bool => try self.readBool(i, options), | 441 | .Bool => try self.readBool(i), |
| 442 | .Void => {}, | 442 | .Void => {}, |
| 443 | .Array => try self.readArray(field.field_type, i), | 443 | .Array => try self.readArray(field.field_type, i), |
| 444 | .Pointer => try self.readPointer(field.field_type, i, options), | 444 | .Pointer => try self.readPointer(field.field_type, i, options), |