vrischmann / zig-sqlite

zig-sqlite is a small wrapper around sqlite's C API, making it easier to use with Zig.
MIT License
367 stars 49 forks source link

Support any size for prepare() queries on comptime #78

Closed lun-4 closed 2 years ago

lun-4 commented 2 years ago

Closes #77 with a hacky solution: By making ParsedQuery generic on the length of the query, and then with a new ParsedQueryFromString helper, to prevent repetition from ParsedQuery(query.len).from(query). Was not ready to change business logic all that much, but removing from() and putting it in the type initializer would be a nicer solution, it can be done if that approach is welcome.

vrischmann commented 2 years ago

Hi, thanks for working on this.

I'm not sure I understand this:

but removing from() and putting it in the type initializer would be a nicer solution

lun-4 commented 2 years ago

Basically, moving from()'s body and putting it directly below ParsedQuery's declaration. With that, you remove the need for ParsedQueryFromString.

vrischmann commented 2 years ago

Ok, well sounds like this approach would be better so I would be interested.

vrischmann commented 2 years ago

Thanks !