You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sqlite3-trans

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlite3-trans

Proper transaction support for node-sqlite3

1.3.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

sqlite3-trans

Proper transaction support for node-sqlite3.

What?

Wraps node-sqlite3 database instances to provide proper transaction support — specifically when utilizing async operations. This module is a more modern port of the no longer maintained sqlite3-transactions.

Differences

  • ES6+
  • lodash vs underscore
  • Don't use deprecated calls
  • I'll try to fix bugs. Please report 'em.

Motivation

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:.

Install

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

License

LICENSE

Keywords

node-sqlite3

FAQs

Package last updated on 04 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts