Socket
Socket
Sign inDemoInstall

sqlite3-trans

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sqlite3-trans

Proper transaction support for node-sqlite3


Version published
Weekly downloads
13
decreased by-18.75%
Maintainers
1
Install size
1.36 MB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 04 Aug 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc