Skip to content

zig 16 update#201

Closed
Queyrouzec wants to merge 10 commits into
vrischmann:masterfrom
Queyrouzec:master
Closed

zig 16 update#201
Queyrouzec wants to merge 10 commits into
vrischmann:masterfrom
Queyrouzec:master

Conversation

@Queyrouzec

Copy link
Copy Markdown
Contributor

Now works on the master branch

Updated IO in build file is now centralized to one variable so that it can be passed as a package argument later.

General writer and reader updates

Removed writer and reader from blob

General std updates

Updated Branch limit due to compile errors in personal use

@Queyrouzec

Copy link
Copy Markdown
Contributor Author

The error is a change in std.time. I'll check it and fix it later tonight or tomorrow.

@jozip jozip mentioned this pull request Jan 3, 2026
@vrischmann

Copy link
Copy Markdown
Owner

Hi,

sorry for not responding earlier.

Thank you for working on this. I'll try to do a first round of review at some point this week.

@jozip

jozip commented Jan 7, 2026

Copy link
Copy Markdown

I got a PR up on the fork with a fix for the time stuff: https://github.com/Queyrouzec/zig-sqlite/pull/1.diff

Use Io.Clock instead of time.Instant in tests
@Queyrouzec

Copy link
Copy Markdown
Contributor Author

Thanks for the help, and sorry for the delayed response. The std is getting a lot easier to understand, but I have no clue where anything is sometimes, and I'm not the best systems programmer. Looking through some of the std implementations, I think that there may also need to be a WASM test runner. I'm going to be messing with WASM some time this year, and I'll add it in then.

@jozip

jozip commented Jan 9, 2026

Copy link
Copy Markdown

Thanks for the help, and sorry for the delayed response. The std is getting a lot easier to understand, but I have no clue where anything is sometimes, and I'm not the best systems programmer. Looking through some of the std implementations, I think that there may also need to be a WASM test runner. I'm going to be messing with WASM some time this year, and I'll add it in then.

Everything is moving (and breaking) very fast on master right now and it's a challenge to keep up. I just think it's cool that more people get their hands dirty. :)

@kamaaina

kamaaina commented May 15, 2026

Copy link
Copy Markdown

I tried cloning and applying the PR to my clone, but i get this error when i try to build:

build.zig:157:45: error: missing struct field: items
    var flags: std.ArrayList([]const u8) = .{};
                                           ~^~
build.zig:157:45: note: missing struct field: capacity
/opt/zig-x86_64-linux-0.16.0/lib/std/array_list.zig:576:12: note: struct declared here
    return struct {
           ^~~~~~
referenced by:
    runBuild__anon_34125: /opt/zig-x86_64-linux-0.16.0/lib/std/Build.zig:2265:44
    main: /opt/zig-x86_64-linux-0.16.0/lib/compiler/build_runner.zig:463:29
    5 reference(s) hidden; use '-freference-trace=7' to see all references
~/d/zig-sqlite (master) [2]>```

@atahanacar

Copy link
Copy Markdown

I tried cloning and applying the PR to my clone, but i get this error when i try to build:

build.zig:157:45: error: missing struct field: items
    var flags: std.ArrayList([]const u8) = .{};

The .{} must be .empty instead.

@rafaelm7o

Copy link
Copy Markdown

This PR is important, and the project hasn't had updates in a couple of months
And Vincent hasn't been active recently

Comment thread sqlite.zig
inline .@"struct", .@"union" => |TI| {
if (TI.layout == .@"packed" and !@hasField(FieldType, "readField")) {
const Backing = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });
const Backing = @TypeOf(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const Backing = @TypeOf(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });
const Backing = @Int(.unsigned, @bitSizeOf(FieldType));

Comment thread sqlite.zig
.@"union" => |info| {
if (info.layout == .@"packed") {
const Backing = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });
const Backing = @TypeOf(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const Backing = @TypeOf(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });
const Backing = @Int(.unsigned, @bitSizeOf(FieldType));

@vrischmann

Copy link
Copy Markdown
Owner

Hi. I appreciate the work but as it stands when running the full test suite with zig build test -Dci=true there are still a lot of things broken.

I tried fixing some issues in https://github.com/vrischmann/zig-sqlite/tree/update-zig-0.16.0 but it's not working yet, for some reason the tests break when cross compiling. If anyone figures out the issue that would be great.

@nektro

nektro commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

seems to be something with comptime memory, this fixes it though

diff --git a/query.zig b/query.zig
index 506842a..eae9129 100644
--- a/query.zig
+++ b/query.zig
@@ -32,11 +32,12 @@ pub fn ParsedQuery(comptime tmp_query: []const u8) type {
         const Self = @This();
 
         const result = parse();
+        const result_query = result.query[0..Self.result.query_len].*;
 
         pub const bind_markers = result.bind_markers[0..result.bind_markers_len];
 
         pub fn getQuery() []const u8 {
-            return Self.result.query[0..Self.result.query_len];
+            return &result_query;
         }
 
         const ParsedQueryResult = struct {
diff --git a/sqlite.zig b/sqlite.zig
index b51f9d9..bc1ab7d 100644
--- a/sqlite.zig
+++ b/sqlite.zig
@@ -1454,7 +1454,7 @@ pub fn Iterator(comptime Type: type) type {
                     },
                     inline .@"struct", .@"union" => |TI| {
                         if (TI.layout == .@"packed" and !@hasField(FieldType, "readField")) {
-                            const Backing = @TypeOf(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });
+                            const Backing = @Int(.unsigned, @bitSizeOf(FieldType));
                             return @bitCast(self.readInt(Backing, i));
                         }
 
@@ -1685,7 +1685,7 @@ pub const DynamicStatement = struct {
                 },
                 .@"union" => |info| {
                     if (info.layout == .@"packed") {
-                        const Backing = @TypeOf(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(FieldType) } });
+                        const Backing = @Int(.unsigned, @bitSizeOf(FieldType));
                         try self.bindField(Backing, options, field_name, i, @as(Backing, @bitCast(field)));
                         return;
                     }

@vrischmann

Copy link
Copy Markdown
Owner

Ok, i got it working. I can't push to this PR though, I'll close it and create a new one with all the changes.

@vrischmann

Copy link
Copy Markdown
Owner

Thanks @nektro

@vrischmann vrischmann closed this Jun 9, 2026
@vrischmann vrischmann mentioned this pull request Jun 9, 2026
@vrischmann

Copy link
Copy Markdown
Owner

Follow up is in #205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants