also looking at this
feat(android): dbExecute and dbQuery in Zig — ratchet 84 → 82
#160
7 files
+541
-3
| @@ -756,6 +756,22 @@ pub const Jni = struct { | ||
| 756 | 756 | return array; |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | pub fn arrayLength(self: Self, array: jobject) JniError!usize { | |
| 760 | const len: *const fn (JNIEnv, jobject) callconv(.c) jsize = | |
| 761 | @ptrCast(self.table().GetArrayLength orelse return JniError.NotFound); | |
| 762 | const result = len(self.env, array); | |
| 763 | try self.check(); | |
| 764 | return @intCast(result); | |
| 765 | } | |
| 766 | ||
| 767 | pub fn objectArrayElement(self: Self, array: jobject, index: usize) JniError!jobject { | |
| 768 | const get: *const fn (JNIEnv, jobject, jsize) callconv(.c) jobject = | |
| 769 | @ptrCast(self.table().GetObjectArrayElement orelse return JniError.NotFound); | |
| 770 | const value = get(self.env, array, @intCast(index)); | |
| 771 | try self.check(); | |
| 772 | return value; | |
| 773 | } | |
| 774 | ||
| 759 | 775 | pub fn setObjectArrayElement(self: Self, array: jobject, index: usize, value: jobject) JniError!void { |
| 760 | 776 | const set: *const fn (JNIEnv, jobject, jsize, jobject) callconv(.c) void = |
| 761 | 777 | @ptrCast(self.table().SetObjectArrayElement orelse return JniError.NotFound); |