Skip to content

Conversation

@mattskel
Copy link

@mattskel mattskel commented Jan 22, 2026

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

Add a statement-level flag to control NULL conversion.
Expose setReadNullAsUndefined() on StatementSync.
Apply to row-reading paths.
Fixes: nodejs#59457
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/sqlite

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. labels Jan 22, 2026
} \
} while (0)

#define SQLITE_VALUE_TO_JS_READ(from, isolate, use_big_int_args, \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This much duplication is not acceptable.

break; \
} \
case SQLITE_NULL: { \
(result) = (read_null_as_undef) ? Undefined((isolate)) : Null((isolate)); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@geeksilva97
Copy link
Contributor

Thanks for this PR. I'm still struggling to see a reason for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlite: statement.setReadNullAsUndefined()

5 participants