summaryrefslogtreecommitdiff
path: root/vtab.zig
diff options
context:
space:
mode:
authorGravatar Ed Yu2023-11-21 15:37:59 -0800
committerGravatar Ed Yu2023-11-21 15:37:59 -0800
commit467c1e9c099a1b12bb84111a7b7544e50b313f77 (patch)
tree719f9af30a7085b83068479d98a65d5302dd1050 /vtab.zig
parentUpdate to sqlite 3.43.2 (diff)
downloadzig-sqlite-467c1e9c099a1b12bb84111a7b7544e50b313f77.tar.gz
zig-sqlite-467c1e9c099a1b12bb84111a7b7544e50b313f77.tar.xz
zig-sqlite-467c1e9c099a1b12bb84111a7b7544e50b313f77.zip
Update to zig 0.12.0-dev.1664+8ca4a5240
Diffstat (limited to '')
-rw-r--r--vtab.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/vtab.zig b/vtab.zig
index f5a5fd5..6fbd865 100644
--- a/vtab.zig
+++ b/vtab.zig
@@ -198,7 +198,7 @@ pub const BestIndexBuilder = struct {
198 const InitError = error{} || mem.Allocator.Error || ConstraintOpFromCodeError; 198 const InitError = error{} || mem.Allocator.Error || ConstraintOpFromCodeError;
199 199
200 fn init(allocator: mem.Allocator, index_info: *c.sqlite3_index_info) InitError!Self { 200 fn init(allocator: mem.Allocator, index_info: *c.sqlite3_index_info) InitError!Self {
201 var res = Self{ 201 const res = Self{
202 .allocator = allocator, 202 .allocator = allocator,
203 .index_info = index_info, 203 .index_info = index_info,
204 .id_str_buffer = std.ArrayList(u8).init(allocator), 204 .id_str_buffer = std.ArrayList(u8).init(allocator),
@@ -538,7 +538,7 @@ pub const ModuleArgument = union(enum) {
538const ParseModuleArgumentsError = error{} || mem.Allocator.Error; 538const ParseModuleArgumentsError = error{} || mem.Allocator.Error;
539 539
540fn parseModuleArguments(allocator: mem.Allocator, argc: c_int, argv: [*c]const [*c]const u8) ParseModuleArgumentsError![]ModuleArgument { 540fn parseModuleArguments(allocator: mem.Allocator, argc: c_int, argv: [*c]const [*c]const u8) ParseModuleArgumentsError![]ModuleArgument {
541 var res = try allocator.alloc(ModuleArgument, @intCast(argc)); 541 const res = try allocator.alloc(ModuleArgument, @intCast(argc));
542 errdefer allocator.free(res); 542 errdefer allocator.free(res);
543 543
544 for (res, 0..) |*marg, i| { 544 for (res, 0..) |*marg, i| {
@@ -585,7 +585,7 @@ pub fn VirtualTable(
585 const InitError = error{} || mem.Allocator.Error || Table.InitError; 585 const InitError = error{} || mem.Allocator.Error || Table.InitError;
586 586
587 fn init(module_context: *ModuleContext, table: *Table) InitError!*Self { 587 fn init(module_context: *ModuleContext, table: *Table) InitError!*Self {
588 var res = try module_context.allocator.create(Self); 588 const res = try module_context.allocator.create(Self);
589 res.* = .{ 589 res.* = .{
590 .vtab = mem.zeroes(c.sqlite3_vtab), 590 .vtab = mem.zeroes(c.sqlite3_vtab),
591 .module_context = module_context, 591 .module_context = module_context,
@@ -615,7 +615,7 @@ pub fn VirtualTable(
615 const InitError = error{} || mem.Allocator.Error || Table.Cursor.InitError; 615 const InitError = error{} || mem.Allocator.Error || Table.Cursor.InitError;
616 616
617 fn init(module_context: *ModuleContext, table: *Table) InitError!*Self { 617 fn init(module_context: *ModuleContext, table: *Table) InitError!*Self {
618 var res = try module_context.allocator.create(Self); 618 const res = try module_context.allocator.create(Self);
619 errdefer module_context.allocator.destroy(res); 619 errdefer module_context.allocator.destroy(res);
620 620
621 res.* = .{ 621 res.* = .{
@@ -839,7 +839,7 @@ pub fn VirtualTable(
839 fn filterArgsFromCPointer(allocator: mem.Allocator, argc: c_int, argv: [*c]?*c.sqlite3_value) FilterArgsFromCPointerError![]FilterArg { 839 fn filterArgsFromCPointer(allocator: mem.Allocator, argc: c_int, argv: [*c]?*c.sqlite3_value) FilterArgsFromCPointerError![]FilterArg {
840 const size: usize = @intCast(argc); 840 const size: usize = @intCast(argc);
841 841
842 var res = try allocator.alloc(FilterArg, size); 842 const res = try allocator.alloc(FilterArg, size);
843 for (res, 0..) |*item, i| { 843 for (res, 0..) |*item, i| {
844 item.* = .{ 844 item.* = .{
845 .value = argv[i], 845 .value = argv[i],
@@ -860,7 +860,7 @@ pub fn VirtualTable(
860 860
861 const id = IndexIdentifier.fromC(idx_num, idx_str); 861 const id = IndexIdentifier.fromC(idx_num, idx_str);
862 862
863 var args = filterArgsFromCPointer(arena.allocator(), argc, argv) catch |err| { 863 const args = filterArgsFromCPointer(arena.allocator(), argc, argv) catch |err| {
864 logger.err("unable to create filter args, err: {!}", .{err}); 864 logger.err("unable to create filter args, err: {!}", .{err});
865 return c.SQLITE_ERROR; 865 return c.SQLITE_ERROR;
866 }; 866 };
@@ -1008,7 +1008,7 @@ const TestVirtualTable = struct {
1008 1008
1009 var rand = std.rand.DefaultPrng.init(204882485); 1009 var rand = std.rand.DefaultPrng.init(204882485);
1010 1010
1011 var tmp = try allocator.alloc(Row, n); 1011 const tmp = try allocator.alloc(Row, n);
1012 for (tmp) |*s| { 1012 for (tmp) |*s| {
1013 const foo_value = data[rand.random().intRangeLessThan(usize, 0, data.len)]; 1013 const foo_value = data[rand.random().intRangeLessThan(usize, 0, data.len)];
1014 const bar_value = data[rand.random().intRangeLessThan(usize, 0, data.len)]; 1014 const bar_value = data[rand.random().intRangeLessThan(usize, 0, data.len)];
@@ -1122,7 +1122,7 @@ const TestVirtualTableCursor = struct {
1122 pub const InitError = error{} || mem.Allocator.Error; 1122 pub const InitError = error{} || mem.Allocator.Error;
1123 1123
1124 pub fn init(allocator: mem.Allocator, parent: *TestVirtualTable) InitError!*TestVirtualTableCursor { 1124 pub fn init(allocator: mem.Allocator, parent: *TestVirtualTable) InitError!*TestVirtualTableCursor {
1125 var res = try allocator.create(TestVirtualTableCursor); 1125 const res = try allocator.create(TestVirtualTableCursor);
1126 res.* = .{ 1126 res.* = .{
1127 .allocator = allocator, 1127 .allocator = allocator,
1128 .parent = parent, 1128 .parent = parent,
@@ -1275,7 +1275,7 @@ test "parse module arguments" {
1275 defer arena.deinit(); 1275 defer arena.deinit();
1276 const allocator = arena.allocator(); 1276 const allocator = arena.allocator();
1277 1277
1278 var args = try allocator.alloc([*c]const u8, 20); 1278 const args = try allocator.alloc([*c]const u8, 20);
1279 for (args, 0..) |*arg, i| { 1279 for (args, 0..) |*arg, i| {
1280 const tmp = try fmt.allocPrintZ(allocator, "arg={d}", .{i}); 1280 const tmp = try fmt.allocPrintZ(allocator, "arg={d}", .{i});
1281 arg.* = @ptrCast(tmp); 1281 arg.* = @ptrCast(tmp);