-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
feat(sqlite): add StatementSync.prototype.iterate
method
#54213
Conversation
16e00d0
to
762e0dc
Compare
762e0dc
to
a73d026
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test in tests/parallel
406165d
to
63a780e
Compare
Tests are added, I did not found better approach than Best regards, |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54213 +/- ##
==========================================
- Coverage 88.49% 87.99% -0.51%
==========================================
Files 653 653
Lines 187728 187852 +124
Branches 36182 35885 -297
==========================================
- Hits 166136 165292 -844
- Misses 14814 15729 +915
- Partials 6778 6831 +53
|
fc82998
to
a413954
Compare
Refs: nodejs#54213 (comment) Co-authored-by: Michaël Zasso <targos@protonmail.com>
Thanks. By the way, that link seems to 404. |
Correct link: #55929 |
PR-URL: nodejs#54213 Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #54213 Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) nodejs#54630 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) nodejs#55890 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) nodejs#54213 PR-URL: #25
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) nodejs#54630 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) nodejs#55890 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) nodejs#54213 PR-URL: #26
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) nodejs#54630 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) nodejs#55890 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) nodejs#54213 PR-URL: #27
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) nodejs#54630 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) nodejs#55890 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) nodejs#54213 PR-URL: #28
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) nodejs#54630 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) nodejs#55890 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) nodejs#54213 PR-URL:
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) nodejs#54630 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) nodejs#55890 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) nodejs#54213 PR-URL: #30
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) #54630 cli: * (SEMVER-MINOR) implement --trace-env and --trace-env-[js|native]-stack (Joyee Cheung) #55604 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) #55890 net: * (SEMVER-MINOR) support blocklist for net.Server (theanarkh) #56079 process: * (SEMVER-MINOR) deprecate `features.{ipv6,uv}` and `features.tls_*` (René) #55545 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) #54213 PR-URL: TODO
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) #54630 cli: * (SEMVER-MINOR) implement --trace-env and --trace-env-[js|native]-stack (Joyee Cheung) #55604 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) #55890 net: * (SEMVER-MINOR) support blocklist for net.Server (theanarkh) #56079 process: * (SEMVER-MINOR) deprecate `features.{ipv6,uv}` and `features.tls_*` (René) #55545 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) #54213 PR-URL: #56119
Notable changes: assert: * (SEMVER-MINOR) add partialDeepStrictEqual (Giovanni Bucci) #54630 cli: * (SEMVER-MINOR) implement --trace-env and --trace-env-[js|native]-stack (Joyee Cheung) #55604 doc,lib,src,test: * (SEMVER-MINOR) unflag sqlite module (Colin Ihrig) #55890 net: * (SEMVER-MINOR) support blocklist for net.Server (theanarkh) #56079 process: * (SEMVER-MINOR) deprecate `features.{ipv6,uv}` and `features.tls_*` (René) #55545 sqlite: * (SEMVER-MINOR) add `StatementSync.prototype.iterate` method (tpoisseau) #54213 PR-URL: #56119
Hello,
I wanted an
iterate
method forStatementSync
. An SQL query can return lot of rows, for memory efficiency it seems important we can fetch rows on demand, instead collect all in an array.I'm not a C/C++ developer, so this was really challenging to create an object with a
next
callback with v8. I tried to obtainIterator.prototype
so the results extends Iterator. I did not found how to do it with v8.I'm sure my code is not ready to be merged:
All
variables fornext
andreturn
callback are wrapped byv8::External
added to iterable_iterator JS Object, accessed from context (
.This()
)iterate()
is a bit hacky. in jssqlite
module I decorate the method to returnIterator.from(<result from cpp iterate>)
.I'm hoping to get some help here to finalize this PR, so that we all get a quality iterate method.
Manual test:
So it's properly integrated with JS iterator protocol, it's an iterable iterator, it's integrated with IteratoHelpers.