Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to add support for iterate() with SQLite statements #14361

Merged
merged 6 commits into from
Oct 12, 2024

Conversation

Skywalker13
Copy link
Contributor

@Skywalker13 Skywalker13 commented Oct 4, 2024

What does this PR do?

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

It's an attempt to add support for iterate() with SQLite statements
(like better-sqlite3 https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#iteratebindparameters---iterator)

Related issues:

These changes are based on the get and all implementations. It's the first time that I see JavaScriptCore stuff. For this feature, I use javascript generators in the wrapper bun:sqlite. I suppose that it should be better to implement in JavaScriptCore but honestly I'm not comfortable enough with it.

I hope that is a good start because IMHO it's an essential feature when working with very large databases.

How did you verify your code works?

  • I included a test for the new code, or existing tests cover it
  • I ran my tests locally and they pass (bun-debug test test-file-name.test)
bun-debug test test/js/bun/sqlite/sqlite.test.js

One test for statement iterator and a test where all() is called after an
interrupted iterate loop.
@Jarred-Sumner Jarred-Sumner merged commit 9744684 into oven-sh:main Oct 12, 2024
14 of 15 checks passed
@Jarred-Sumner
Copy link
Collaborator

Thank you for this! Sorry it took a bit of time to merge.

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.

Add SQLite cursor API SQLite Iterators Make sqlite Statement iterable
2 participants