Proper transaction support for node-sqlite3
npm install sqlite3-transDifferences
* ES6+
* lodash vs underscore
* Don't use deprecated calls
* I'll try to fix bugs. Please report 'em.
Considering the following:
```
db.serialize( () => {
db.exec('BEGIN;');
// ...
fetchAndInsert(db, () => {
db.exec('COMMIT;');
});
});
We just created ourselves a bug! Other database operations in the code may try to do I/O with our DB while in the transaction including an attempt to create another transaction resulting in SQLITE_ERROR: cannot start a transaction within a transaction :poop:.
yarn install node-sqlite3
yarn install sqlite3-trans
`Example Usage
`
const sqlite3 = require('sqlite3');
const sqlite3Trans = require('sqlite3-trans');const db = sqlite3Trans.wrap(new sqlite3.Database('lmftfy.db'));
``