GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: return `undefined` if no rows are returned in SQLite · nodejs/node@3fdcf7a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_sqlite.cc
  • test/parallel
    • test-sqlite.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_sqlite.cc‎

Copy file name to clipboardExpand all lines: src/node_sqlite.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,8 @@ void StatementSync::Get(const FunctionCallbackInfo<Value>& args) {
480480

481481
auto reset = OnScopeLeave([&]() { sqlite3_reset(stmt->statement_); });
482482
r = sqlite3_step(stmt->statement_);
483-
if (r != SQLITE_ROW && r != SQLITE_DONE) {
483+
if (r == SQLITE_DONE) return;
484+
if (r != SQLITE_ROW) {
484485
THROW_ERR_SQLITE_ERROR(env->isolate(), stmt->db_);
485486
return;
486487
}
Collapse file

‎test/parallel/test-sqlite.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-sqlite.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ suite('StatementSync() constructor', () => {
219219
suite('StatementSync.prototype.get()', () => {
220220
test('executes a query and returns undefined on no results', (t) => {
221221
const db = new DatabaseSync(nextDb());
222-
const stmt = db.prepare('CREATE TABLE storage(key TEXT, val TEXT)');
222+
let stmt = db.prepare('CREATE TABLE storage(key TEXT, val TEXT)');
223+
t.assert.strictEqual(stmt.get(), undefined);
224+
stmt = db.prepare('SELECT * FROM storage');
223225
t.assert.strictEqual(stmt.get(), undefined);
224226
});
225227

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.