Socket
Socket
Sign inDemoInstall

better-sqlite3

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-sqlite3 - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

bench.js

2

package.json
{
"name": "better-sqlite3",
"version": "3.0.3",
"version": "3.1.0",
"description": "The fastest and simplest library for SQLite3 in Node.js.",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/JoshuaWise/better-sqlite3",

@@ -43,2 +43,3 @@ var expect = require('chai').expect;

expect(db.open).to.be.true;
expect(db.inTransaction).to.be.false;
fs.accessSync(util.current());

@@ -53,2 +54,3 @@ });

expect(db.open).to.be.true;
expect(db.inTransaction).to.be.false;
expect(function () {fs.accessSync(util.current());}).to.throw(Error);

@@ -66,2 +68,3 @@ });

expect(db.open).to.be.true;
expect(db.inTransaction).to.be.false;
fs.accessSync(util.current());

@@ -76,2 +79,3 @@ });

expect(db.open).to.be.true;
expect(db.inTransaction).to.be.false;
expect(function () {fs.accessSync(util.current());}).to.throw(Error);

@@ -78,0 +82,0 @@ });

@@ -56,7 +56,11 @@ 'use strict';

it('should work with BEGIN and COMMIT', function () {
expect(db.inTransaction).to.equal(false);
expect(db.prepare("BEGIN TRANSACTION").run().changes).to.equal(0);
expect(db.inTransaction).to.equal(true);
var info = db.prepare("INSERT INTO entries VALUES ('foo', 25, 3.14, x'1133ddff')").run();
expect(info.changes).to.equal(1);
expect(info.lastInsertROWID).to.equal(3);
expect(db.inTransaction).to.equal(true);
expect(db.prepare("COMMIT TRANSACTION").run().changes).to.equal(0);
expect(db.inTransaction).to.equal(false);
});

@@ -63,0 +67,0 @@ it('should work with DROP TABLE', function () {

@@ -50,2 +50,3 @@ 'use strict';

it('should rollback and throw an exception for failed constraints', function () {
expect(db.inTransaction).to.equal(false);
db.transaction(['CREATE TABLE people (id INTEGER PRIMARY KEY, name TEXT)']).run();

@@ -66,3 +67,5 @@ db.transaction(['CREATE TABLE ages (age INTEGER, person INTEGER NOT NULL REFERENCES people ON DELETE CASCADE ON UPDATE CASCADE)']).run();

]);
expect(db.inTransaction).to.equal(false);
expect(function () {trans.run();}).to.throw(Database.SqliteError).with.property('code', 'SQLITE_CONSTRAINT_FOREIGNKEY');
expect(db.inTransaction).to.equal(false);
trans = db.transaction([

@@ -72,5 +75,8 @@ "INSERT INTO ages VALUES (40, 1)",

]);
expect(db.inTransaction).to.equal(false);
expect(function () {trans.run();}).to.throw(Database.SqliteError).with.property('code', 'SQLITE_CONSTRAINT_NOTNULL');
expect(db.inTransaction).to.equal(false);
expect(db.prepare('SELECT * FROM ages WHERE age==35').get()).to.not.be.undefined;
expect(db.prepare('SELECT * FROM ages WHERE age==40').get()).to.be.undefined;
expect(db.inTransaction).to.equal(false);
db.transaction([

@@ -80,3 +86,5 @@ "INSERT INTO ages VALUES (40, 1)",

]).run();
expect(db.inTransaction).to.equal(false);
expect(db.prepare('SELECT * FROM ages WHERE age==40').get()).to.not.be.undefined;
expect(db.inTransaction).to.equal(false);
});

@@ -83,0 +91,0 @@ it('should not count changes from indirect mechanisms', function () {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc