🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

better-sqlite3

Package Overview
Dependencies
Maintainers
1
Versions
143
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

to
7.2.0

2

docs/api.md

@@ -291,4 +291,2 @@ # API

**(only on statements that do not return data)*
Executes the prepared statement. When execution completes it returns an `info` object describing any changes made. The `info` object has two properties:

@@ -295,0 +293,0 @@

2

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

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

@@ -22,6 +22,2 @@ 'use strict';

it('should throw an exception when used on a statement that returns data', function () {
const stmt = this.db.prepare('SELECT 555');
expect(() => stmt.run()).to.throw(TypeError);
});
it('should work with CREATE TABLE', function () {

@@ -38,2 +34,8 @@ const { info } = this.db.init();

});
it('should work with SELECT', function () {
const stmt = this.db.prepare('SELECT 555');
const info = stmt.run();
expect(info.changes).to.equal(0);
expect(info.lastInsertRowid).to.equal(0);
});
it('should work with INSERT INTO', function () {

@@ -40,0 +42,0 @@ let stmt = this.db.init().prepare("INSERT INTO entries VALUES ('foo', 25, 3.14, x'1133ddff')");

@@ -35,2 +35,10 @@ 'use strict';

});
it('should work with RETURNING clause', function () {
let stmt = this.db.prepare("INSERT INTO entries (a, b) VALUES ('bar', 888), ('baz', 999) RETURNING *");
expect(stmt.reader).to.be.true;
expect(stmt.get()).to.deep.equal({ a: 'bar', b: 888, c: null, d: null, e: null });
stmt = this.db.prepare("SELECT * FROM entries WHERE b > 900 ORDER BY rowid");
expect(stmt.get()).to.deep.equal({ a: 'baz', b: 999, c: null, d: null, e: null });
});
it('should obey the current pluck and expand settings', function () {

@@ -37,0 +45,0 @@ const stmt = this.db.prepare("SELECT *, 2 + 3.5 AS c FROM entries ORDER BY rowid");

@@ -46,2 +46,16 @@ 'use strict';

});
it('should work with RETURNING clause', function () {
let stmt = this.db.prepare("INSERT INTO entries (a, b) VALUES ('bar', 888), ('baz', 999) RETURNING *");
expect(stmt.reader).to.be.true;
expect(stmt.all()).to.deep.equal([
{ a: 'bar', b: 888, c: null, d: null, e: null },
{ a: 'baz', b: 999, c: null, d: null, e: null },
]);
stmt = this.db.prepare("SELECT * FROM entries WHERE b > 800 ORDER BY rowid");
expect(stmt.all()).to.deep.equal([
{ a: 'bar', b: 888, c: null, d: null, e: null },
{ a: 'baz', b: 999, c: null, d: null, e: null },
]);
});
it('should obey the current pluck and expand settings', function () {

@@ -48,0 +62,0 @@ const stmt = this.db.prepare("SELECT *, 2 + 3.5 AS c FROM entries ORDER BY rowid");

@@ -61,2 +61,16 @@ 'use strict';

});
it('should work with RETURNING clause', function () {
let stmt = this.db.prepare("INSERT INTO entries (a, b) VALUES ('bar', 888), ('baz', 999) RETURNING *");
expect(stmt.reader).to.be.true;
expect([...stmt.iterate()]).to.deep.equal([
{ a: 'bar', b: 888, c: null, d: null, e: null },
{ a: 'baz', b: 999, c: null, d: null, e: null },
]);
stmt = this.db.prepare("SELECT * FROM entries WHERE b > 800 ORDER BY rowid");
expect([...stmt.iterate()]).to.deep.equal([
{ a: 'bar', b: 888, c: null, d: null, e: null },
{ a: 'baz', b: 999, c: null, d: null, e: null },
]);
});
it('should obey the current pluck and expand settings', function () {

@@ -63,0 +77,0 @@ const shouldHave = (desiredData) => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet