summaryrefslogtreecommitdiff
path: root/sqlite.zig
diff options
context:
space:
mode:
authorGravatar Vincent Rischmann2022-05-02 18:12:29 +0200
committerGravatar Vincent Rischmann2022-05-02 18:12:30 +0200
commit8d93174b1c0ade7d39e33446e1f7ccdbe15e43ec (patch)
treea900a7b94a37a63d86ad1dc437beea16168a084f /sqlite.zig
parentMakes sqlite.Error pub. (diff)
downloadzig-sqlite-8d93174b1c0ade7d39e33446e1f7ccdbe15e43ec.tar.gz
zig-sqlite-8d93174b1c0ade7d39e33446e1f7ccdbe15e43ec.tar.xz
zig-sqlite-8d93174b1c0ade7d39e33446e1f7ccdbe15e43ec.zip
put the TODO comment at the end of the line instead
When using an explicit error set one must add the "Workaround" error in their error set; putting the explanation as to why it exists at the end of the line makes it so it is displayed directly in the output of the compiler. Before a user had to go look at the source code to understand why we have this workaround.
Diffstat (limited to '')
-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 }