A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/3fdcf7a47d below:

return `undefined` if no rows are returned in SQLite · nodejs/node@3fdcf7a · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+5

-2

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+5

-2

lines changed Original file line number Diff line number Diff line change

@@ -480,7 +480,8 @@ void StatementSync::Get(const FunctionCallbackInfo<Value>& args) {

480 480 481 481

auto reset = OnScopeLeave([&]() { sqlite3_reset(stmt->statement_); });

482 482

r = sqlite3_step(stmt->statement_);

483 -

if (r != SQLITE_ROW && r != SQLITE_DONE) {

483 +

if (r == SQLITE_DONE) return;

484 +

if (r != SQLITE_ROW) {

484 485

THROW_ERR_SQLITE_ERROR(env->isolate(), stmt->db_);

485 486

return;

486 487

}

Original file line number Diff line number Diff line change

@@ -219,7 +219,9 @@ suite('StatementSync() constructor', () => {

219 219

suite('StatementSync.prototype.get()', () => {

220 220

test('executes a query and returns undefined on no results', (t) => {

221 221

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');

223 225

t.assert.strictEqual(stmt.get(), undefined);

224 226

});

225 227

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4