I'm using better-sqlite in node to access an sqlite3 database.
Is there a way to pass a single parameter to all()
or get()
and use it multiple times in the statement. At the moment I'm doing this:
const statement = `SELECT * FROM table WHERE
column_1 = ?
OR
column_2 = ?
OR
column_3 = ?
`;
const param = 'something';
const results = db.prepare(statement).all(
param,
param,
param
);
But I would like to do something like this:
const statement = `SELECT * FROM table WHERE
column_1 = ?1
OR
column_2 = ?1
OR
column_3 = ?1
`;
const param = 'something';
const results = db.prepare(statement).all(
param
);