Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.
This repository was archived by the owner on Jul 1, 2026. It is now read-only.

Unhandled null parameters #116

Description

@jooadam
var sqlite = require('sqlite3').verbose();
var db = new sqlite.Database('test.db');

db.all('SELECT * FROM test', null, function (error, rows) {
    if (error) {
        console.log(error);
    } else {
        rows.forEach(function (row) {
            console.log(row);
        });
    }
});

db.close();

The previous code will produce the following output:

{ [Error: SQLITE_RANGE: bind or column index out of range] errno: 25, code: 'SQLITE_RANGE' }

Changing the second argument of Database#all() from null to [] produces the desired output.

This handling of null values is both counterintuitive and undocumented. Other methods may be affected too.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions