sqlite: support reading NULL as undefined in result sets#61472
Open
mattskel wants to merge 2 commits intonodejs:mainfrom
Open
sqlite: support reading NULL as undefined in result sets#61472mattskel wants to merge 2 commits intonodejs:mainfrom
mattskel wants to merge 2 commits intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
louwers
reviewed
Jan 22, 2026
src/node_sqlite.cc
Outdated
| } \ | ||
| } while (0) | ||
|
|
||
| #define SQLITE_VALUE_TO_JS_READ(from, isolate, use_big_int_args, \ |
Contributor
There was a problem hiding this comment.
This much duplication is not acceptable.
himself65
reviewed
Jan 22, 2026
src/node_sqlite.cc
Outdated
| break; \ | ||
| } \ | ||
| case SQLITE_NULL: { \ | ||
| (result) = (read_null_as_undef) ? Undefined((isolate)) : Null((isolate)); \ |
Member
There was a problem hiding this comment.
The main difference between SQLITE_VALUE_TO_JS_READ and SQLITE_VALUE_TO_JS is just the way of handling null values? Can we simplify the code?
Contributor
|
Thanks for this PR. I'm still struggling to see a reason for it. |
Add a statement-level flag to control NULL conversion. Expose setReadNullAsUndefined() on StatementSync. Apply to row-reading paths. Fixes: nodejs#59457
Refactor SQLITE_NULL case in SQLITE_VALUE_TO_JS. Remove SQLITE_VALUE_TO_JS_READ macro. Update sqlite docs. Add testing for SetReadNullAsUndefined implementation.
de7bf9f to
66ce7e4
Compare
|
There is similar PR here #59462, I have not compared them. Any PR for this issue needs to add to database.prepare(sql[, options]) as the Also the option should be added to new DatabaseSync(path[, options]) in addition to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a statement-level flag to control how SQL NULL values are materialised in results. Expose setReadNullAsUndefined() on StatementSync and apply it to row-reading paths (get, all, iterate, columnToValue) without affecting function arguments or write paths.
Fixes: #59457