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

Run multiple statements in a single query #79

Closed lun-4 closed 2 years ago

lun-4 commented 2 years ago

This PR adds Db.runMulti(), which wraps statement prepare/execution in a loop so that it can process multiple statements from a single query string. SQLite enables this to happen via the pzTail argument in sqlite_prepare family of functions.

If this function is not welcome, this PR can be reduced to only enabling pzTail usage through QueryOptions, since with that the logic of runMulti can be moved over to library users.

vrischmann commented 2 years ago

Hi,

sorry it took me a while to get to this PR. I like this feature but I think the function should be named execMulti instead since no other function use the name "run".

Also, can you please rebase so it can be merged ? Thank you !