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

src: return undefined if no rows are returned in SQLite #53981

Merged

Conversation

deokjinkim
Copy link
Contributor

@deokjinkim deokjinkim commented Jul 21, 2024

For now, { key: null, value: null} is returned even though no rows are returned from database when statement.get() is called. So return empty value if return value of sqlite3_step is SQLITE_DONE.

With below example, undefined is expected as return value of statement.get().
But { key: null, value: null } is returned actually without this PR.

'use strict';
const { DatabaseSync } = require('node:sqlite');
const database = new DatabaseSync(':memory:');

let stmt = database.prepare('CREATE TABLE storage(key TEXT, val TEXT)');
console.log(stmt.get()); // undefined
stmt = database.prepare('SELECT * FROM storage');
console.log(stmt.get()); // { key: null, value: null } -> undefined

For now, { key: null, value: null} is returned even though
no rows are returned from database when `statement.get()`
is called. So return empty value if return value of
`sqlite3_step` is `SQLITE_DONE`.
@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 Jul 21, 2024
@jasnell jasnell added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 21, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 21, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@deokjinkim deokjinkim added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 22, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 23, 2024
@nodejs-github-bot nodejs-github-bot merged commit db594d0 into nodejs:main Jul 23, 2024
69 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in db594d0

targos pushed a commit that referenced this pull request Jul 28, 2024
For now, { key: null, value: null} is returned even though
no rows are returned from database when `statement.get()`
is called. So return empty value if return value of
`sqlite3_step` is `SQLITE_DONE`.

PR-URL: #53981
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@RafaelGSS RafaelGSS mentioned this pull request Jul 30, 2024
RafaelGSS pushed a commit that referenced this pull request Aug 5, 2024
For now, { key: null, value: null} is returned even though
no rows are returned from database when `statement.get()`
is called. So return empty value if return value of
`sqlite3_step` is `SQLITE_DONE`.

PR-URL: #53981
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@targos targos added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. 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.

6 participants