Skip to content

sqlite: statement.setReadNullAsUndefined() #59457

@LiviaMedeiros

Description

@LiviaMedeiros

What is the problem this feature will solve?

In JS, we have two different oddballs null and undefined. In SQL, they are represented as NULL.
Inserting them to database makes them coerced to NULL; however selecting to JS realm always produces nulls, which is not always desirable.

What is the feature you are proposing to solve the problem?

Similarly to statement.setReadBigInts(enabled), we can have statement.setReadNullAsUndefined() to make reads return NULLs as undefined instead of null.

Also we can have database-wide readNullAsUndefined option in new DatabaseSync(path[, options])

What alternatives have you considered?

Drowning in boilerplate code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.sqliteIssues and PRs related to the SQLite subsystem.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions