From 4314d79571d1a105366eb97b6a845aa6f3a3564a Mon Sep 17 00:00:00 2001 From: Tim Macfarlane Date: Mon, 1 Feb 2016 11:58:38 +0100 Subject: [PATCH] passing options to sqlite3 --- readme.md | 12 ++++++++++++ sqliteDriver.js | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/readme.md b/readme.md index a6b6382..227b5e5 100644 --- a/readme.md +++ b/readme.md @@ -533,3 +533,15 @@ person.query('select * from people where id = @id', {id: 1}, function (people) { return bob.save(); }); ``` + +## Options + +You can pass options to the database driver when executing a query + +```js +db.query(sql, parameters, [options]) +``` + +* SQLite3 + `exec` runs the `exec()` method on the connection, see [exec](https://github.com/mapbox/node-sqlite3/wiki/API#databaseexecsql-callback). Note that this method ignores any query `parameters` passed in. + diff --git a/sqliteDriver.js b/sqliteDriver.js index c663660..bf0b371 100644 --- a/sqliteDriver.js +++ b/sqliteDriver.js @@ -27,6 +27,11 @@ module.exports = function() { } }); }); + } else if (options && options.exec) { + return promisify(function (cb) { + debug(query, sqliteParams); + self.connection.exec(query, cb); + }); } else { return promisify(function (cb) { debug(query, sqliteParams);