summaryrefslogtreecommitdiff
path: root/sqlite.zig
diff options
context:
space:
mode:
Diffstat (limited to 'sqlite.zig')
-rw-r--r--sqlite.zig12
1 files changed, 3 insertions, 9 deletions
diff --git a/sqlite.zig b/sqlite.zig
index 609744f..5299e7f 100644
--- a/sqlite.zig
+++ b/sqlite.zig
@@ -1222,25 +1222,19 @@ pub fn Iterator(comptime Type: type) type {
1222 } 1222 }
1223 1223
1224 // readInt reads a sqlite INTEGER column into an integer. 1224 // readInt reads a sqlite INTEGER column into an integer.
1225 // 1225 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
1226 // TODO remove the workaround once https://github.com/ziglang/zig/issues/5149 is resolved or if we actually return an error
1227 fn readInt(self: *Self, comptime IntType: type, i: usize) error{Workaround}!IntType {
1228 const n = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i)); 1226 const n = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i));
1229 return @intCast(IntType, n); 1227 return @intCast(IntType, n);
1230 } 1228 }
1231 1229
1232 // readFloat reads a sqlite REAL column into a float. 1230 // readFloat reads a sqlite REAL column into a float.
1233 // 1231 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
1234 // TODO remove the workaround once https://github.com/ziglang/zig/issues/5149 is resolved or if we actually return an error
1235 fn readFloat(self: *Self, comptime FloatType: type, i: usize) error{Workaround}!FloatType {
1236 const d = c.sqlite3_column_double(self.stmt, @intCast(c_int, i)); 1232 const d = c.sqlite3_column_double(self.stmt, @intCast(c_int, i));
1237 return @floatCast(FloatType, d); 1233 return @floatCast(FloatType, d);
1238 } 1234 }
1239 1235
1240 // readFloat reads a sqlite INTEGER column into a bool (true is anything > 0, false is anything <= 0). 1236 // readFloat reads a sqlite INTEGER column into a bool (true is anything > 0, false is anything <= 0).
1241 // 1237 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
1242 // TODO remove the workaround once https://github.com/ziglang/zig/issues/5149 is resolved or if we actually return an error
1243 fn readBool(self: *Self, i: usize) error{Workaround}!bool {
1244 const d = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i)); 1238 const d = c.sqlite3_column_int64(self.stmt, @intCast(c_int, i));
1245 return d > 0; 1239 return d > 0;
1246 } 1240 }