@vscode/sqlite3
Advanced tools
Comparing version 5.0.8 to 5.1.2
@@ -1,5 +0,5 @@ | ||
/*var binary = require('@mapbox/node-pre-gyp'); | ||
var path = require('path'); | ||
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));*/ | ||
var binding = require('../build/Release/vscode-sqlite3.node'); | ||
/*const binary = require('@mapbox/node-pre-gyp'); | ||
const path = require('path'); | ||
const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));*/ | ||
const binding = require('../build/Release/vscode-sqlite3.node'); | ||
module.exports = exports = binding; |
@@ -1,4 +0,4 @@ | ||
var path = require('path'); | ||
var sqlite3 = require('./sqlite3-binding.js'); | ||
var EventEmitter = require('events').EventEmitter; | ||
const path = require('path'); | ||
const sqlite3 = require('./sqlite3-binding.js'); | ||
const EventEmitter = require('events').EventEmitter; | ||
module.exports = exports = sqlite3; | ||
@@ -8,6 +8,7 @@ | ||
return function (sql) { | ||
var errBack; | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
let errBack; | ||
const args = Array.prototype.slice.call(arguments, 1); | ||
if (typeof args[args.length - 1] === 'function') { | ||
var callback = args[args.length - 1]; | ||
const callback = args[args.length - 1]; | ||
errBack = function(err) { | ||
@@ -19,3 +20,3 @@ if (err) { | ||
} | ||
var statement = new Statement(this, sql, errBack); | ||
const statement = new Statement(this, sql, errBack); | ||
return fn.call(this, statement, args); | ||
@@ -26,3 +27,3 @@ }; | ||
function inherits(target, source) { | ||
for (var k in source.prototype) | ||
for (const k in source.prototype) | ||
target.prototype[k] = source.prototype[k]; | ||
@@ -38,5 +39,4 @@ } | ||
var db; | ||
let db; | ||
file = path.resolve(file); | ||
function cb() { callback.call(db, null); } | ||
@@ -49,4 +49,5 @@ if (!sqlite3.cached.objects[file]) { | ||
db = sqlite3.cached.objects[file]; | ||
var callback = (typeof a === 'number') ? b : a; | ||
const callback = (typeof a === 'number') ? b : a; | ||
if (typeof callback === 'function') { | ||
function cb() { callback.call(db, null); } | ||
if (db.open) process.nextTick(cb); | ||
@@ -63,5 +64,5 @@ else db.once('open', cb); | ||
var Database = sqlite3.Database; | ||
var Statement = sqlite3.Statement; | ||
var Backup = sqlite3.Backup; | ||
const Database = sqlite3.Database; | ||
const Statement = sqlite3.Statement; | ||
const Backup = sqlite3.Backup; | ||
@@ -111,3 +112,3 @@ inherits(Database, EventEmitter); | ||
Database.prototype.backup = function() { | ||
var backup; | ||
let backup; | ||
if (arguments.length <= 2) { | ||
@@ -127,18 +128,19 @@ // By default, we write the main database out to the main database of the named file. | ||
Statement.prototype.map = function() { | ||
var params = Array.prototype.slice.call(arguments); | ||
var callback = params.pop(); | ||
const params = Array.prototype.slice.call(arguments); | ||
const callback = params.pop(); | ||
params.push(function(err, rows) { | ||
if (err) return callback(err); | ||
var result = {}; | ||
const result = {}; | ||
if (rows.length) { | ||
var keys = Object.keys(rows[0]), key = keys[0]; | ||
const keys = Object.keys(rows[0]); | ||
const key = keys[0]; | ||
if (keys.length > 2) { | ||
// Value is an object | ||
for (var i = 0; i < rows.length; i++) { | ||
for (let i = 0; i < rows.length; i++) { | ||
result[rows[i][key]] = rows[i]; | ||
} | ||
} else { | ||
var value = keys[1]; | ||
const value = keys[1]; | ||
// Value is a plain value | ||
for (i = 0; i < rows.length; i++) { | ||
for (let i = 0; i < rows.length; i++) { | ||
result[rows[i][key]] = rows[i][value]; | ||
@@ -153,8 +155,8 @@ } | ||
var isVerbose = false; | ||
let isVerbose = false; | ||
var supportedEvents = [ 'trace', 'profile', 'insert', 'update', 'delete' ]; | ||
const supportedEvents = [ 'trace', 'profile', 'change' ]; | ||
Database.prototype.addListener = Database.prototype.on = function(type) { | ||
var val = EventEmitter.prototype.addListener.apply(this, arguments); | ||
const val = EventEmitter.prototype.addListener.apply(this, arguments); | ||
if (supportedEvents.indexOf(type) >= 0) { | ||
@@ -167,3 +169,3 @@ this.configure(type, true); | ||
Database.prototype.removeListener = function(type) { | ||
var val = EventEmitter.prototype.removeListener.apply(this, arguments); | ||
const val = EventEmitter.prototype.removeListener.apply(this, arguments); | ||
if (supportedEvents.indexOf(type) >= 0 && !this._events[type]) { | ||
@@ -176,3 +178,3 @@ this.configure(type, false); | ||
Database.prototype.removeAllListeners = function(type) { | ||
var val = EventEmitter.prototype.removeAllListeners.apply(this, arguments); | ||
const val = EventEmitter.prototype.removeAllListeners.apply(this, arguments); | ||
if (supportedEvents.indexOf(type) >= 0) { | ||
@@ -187,3 +189,3 @@ this.configure(type, false); | ||
if (!isVerbose) { | ||
var trace = require('./trace'); | ||
const trace = require('./trace'); | ||
[ | ||
@@ -216,3 +218,3 @@ 'prepare', | ||
return this; | ||
return sqlite3; | ||
}; |
// Inspired by https://github.com/tlrobinson/long-stack-traces | ||
var util = require('util'); | ||
const util = require('util'); | ||
function extendTrace(object, property, pos) { | ||
var old = object[property]; | ||
const old = object[property]; | ||
object[property] = function() { | ||
var error = new Error(); | ||
var name = object.constructor.name + '#' + property + '(' + | ||
const error = new Error(); | ||
const name = object.constructor.name + '#' + property + '(' + | ||
Array.prototype.slice.call(arguments).map(function(el) { | ||
@@ -15,6 +15,6 @@ return util.inspect(el, false, 0); | ||
if (pos < 0) pos += arguments.length; | ||
var cb = arguments[pos]; | ||
const cb = arguments[pos]; | ||
if (typeof arguments[pos] === 'function') { | ||
arguments[pos] = function replacement() { | ||
var err = arguments[0]; | ||
const err = arguments[0]; | ||
if (err && err.stack && !err.__augmented) { | ||
@@ -21,0 +21,0 @@ err.stack = filter(err).join('\n'); |
{ | ||
"name": "@vscode/sqlite3", | ||
"description": "Asynchronous, non-blocking SQLite3 bindings", | ||
"version": "5.0.8", | ||
"homepage": "https://github.com/mapbox/node-sqlite3", | ||
"version": "5.1.2", | ||
"homepage": "https://github.com/microsoft/vscode-node-sqlite3", | ||
"author": { | ||
"name": "MapBox", | ||
"name": "Mapbox", | ||
"url": "https://mapbox.com/" | ||
@@ -12,8 +12,9 @@ }, | ||
"module_name": "node_sqlite3", | ||
"module_path": "./lib/binding/napi-v{napi_build_version}-{platform}-{arch}", | ||
"host": "https://mapbox-node-binary.s3.amazonaws.com", | ||
"remote_path": "./{name}/v{version}/{toolset}/", | ||
"package_name": "napi-v{napi_build_version}-{platform}-{arch}.tar.gz", | ||
"module_path": "./lib/binding/napi-v{napi_build_version}-{platform}-{libc}-{arch}", | ||
"host": "https://github.com/TryGhost/node-sqlite3/releases/download/", | ||
"remote_path": "v{version}", | ||
"package_name": "napi-v{napi_build_version}-{platform}-{libc}-{arch}.tar.gz", | ||
"napi_versions": [ | ||
3 | ||
3, | ||
6 | ||
] | ||
@@ -39,5 +40,12 @@ }, | ||
], | ||
"files": [ | ||
"binding.gyp", | ||
"deps/", | ||
"lib/*.js", | ||
"lib/*.d.ts", | ||
"src/" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mapbox/node-sqlite3.git" | ||
"url": "https://github.com/microsoft/vscode-node-sqlite3.git" | ||
}, | ||
@@ -48,7 +56,6 @@ "dependencies": { | ||
"devDependencies": { | ||
"@mapbox/cloudfriend": "^1.9.0", | ||
"aws-sdk": "2.x", | ||
"electron": "17.1.2", | ||
"electron": "19.1.3", | ||
"eslint": "^7.32.0", | ||
"mocha": "^5.2.0" | ||
"mocha": "7.2.0", | ||
"tar": "^6.1.11" | ||
}, | ||
@@ -68,3 +75,8 @@ "scripts": { | ||
"main": "./lib/sqlite3", | ||
"types": "index.d.ts" | ||
"types": "./lib/sqlite3.d.ts", | ||
"renovate": { | ||
"extends": [ | ||
"@tryghost:base" | ||
] | ||
} | ||
} |
226
README.md
@@ -0,77 +1,101 @@ | ||
# ⚙️ node-sqlite3 | ||
Asynchronous, non-blocking [SQLite3](https://sqlite.org/) bindings for [Node.js](http://nodejs.org/). | ||
[![NPM](https://nodei.co/npm/sqlite3.png?downloads=true&downloadRank=true)](https://nodei.co/npm/sqlite3/) | ||
[![Build Status](https://travis-ci.org/mapbox/node-sqlite3.svg?branch=master)](https://travis-ci.org/mapbox/node-sqlite3) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/gvm7ul0hpmdawqom)](https://ci.appveyor.com/project/Mapbox/node-sqlite3) | ||
[![Coverage Status](https://coveralls.io/repos/mapbox/node-sqlite3/badge.svg?branch=master&service=github)](https://coveralls.io/github/mapbox/node-sqlite3?branch=master) | ||
[![Dependencies](https://david-dm.org/mapbox/node-sqlite3.svg)](https://david-dm.org/mapbox/node-sqlite3) | ||
[![Latest release](https://img.shields.io/github/release/TryGhost/node-sqlite3.svg)](https://www.npmjs.com/package/sqlite3) | ||
![Build Status](https://github.com/TryGhost/node-sqlite3/workflows/CI/badge.svg?branch=master) | ||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3?ref=badge_shield) | ||
[![N-API v3 Badge](https://img.shields.io/badge/N--API-v3-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api) | ||
[![N-API v6 Badge](https://img.shields.io/badge/N--API-v6-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api) | ||
## Supported platforms | ||
# Features | ||
The `sqlite3` module works with: | ||
* Node.js v11.x, v12.x, v13.x and v14.x. | ||
* Electron v6.0.x, v6.1.x, v7.0.x, v7.1.x, v8.0.x, v8.1.x and v8.2.x | ||
- Straightforward query and parameter binding interface | ||
- Full Buffer/Blob support | ||
- Extensive [debugging support](https://github.com/tryghost/node-sqlite3/wiki/Debugging) | ||
- [Query serialization](https://github.com/tryghost/node-sqlite3/wiki/Control-Flow) API | ||
- [Extension support](https://github.com/TryGhost/node-sqlite3/wiki/API#databaseloadextensionpath-callback), including bundled support for the [json1 extension](https://www.sqlite.org/json1.html) | ||
- Big test suite | ||
- Written in modern C++ and tested for memory leaks | ||
- Bundles SQLite v3.39.4, or you can build using a local SQLite | ||
Binaries for most Node versions and platforms are provided by default via [node-pre-gyp](https://github.com/mapbox/node-pre-gyp). | ||
# Installing | ||
The `sqlite3` module also works with [node-webkit](https://github.com/rogerwang/node-webkit) if node-webkit contains a supported version of Node.js engine. [(See below.)](#building-for-node-webkit) | ||
You can use [`npm`](https://github.com/npm/cli) or [`yarn`](https://github.com/yarnpkg/yarn) to install `sqlite3`: | ||
SQLite's [SQLCipher extension](https://github.com/sqlcipher/sqlcipher) is also supported. [(See below.)](#building-for-sqlcipher) | ||
* (recommended) Latest published package: | ||
```bash | ||
npm install sqlite3 | ||
# or | ||
yarn add sqlite3 | ||
``` | ||
* GitHub's `master` branch: `npm install https://github.com/tryghost/node-sqlite3/tarball/master` | ||
# Usage | ||
### Prebuilt binaries | ||
**Note:** the module must be [installed](#installing) before use. | ||
`sqlite3` v5+ was rewritten to use [Node-API](https://nodejs.org/api/n-api.html) so prebuilt binaries do not need to be built for specific Node versions. `sqlite3` currently builds for both Node-API v3 and v6. Check the [Node-API version matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix) to ensure your Node version supports one of these. The prebuilt binaries should be supported on Node v10+. | ||
``` js | ||
var sqlite3 = require('sqlite3').verbose(); | ||
var db = new sqlite3.Database(':memory:'); | ||
The module uses [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) to download the prebuilt binary for your platform, if it exists. These binaries are hosted on GitHub Releases for `sqlite3` versions above 5.0.2, and they are hosted on S3 otherwise. The following targets are currently provided: | ||
db.serialize(function() { | ||
db.run("CREATE TABLE lorem (info TEXT)"); | ||
Format: `napi-v{napi_build_version}-{platform}-{libc}-{arch}` | ||
var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); | ||
for (var i = 0; i < 10; i++) { | ||
stmt.run("Ipsum " + i); | ||
} | ||
stmt.finalize(); | ||
* `napi-v3-darwin-unknown-arm64` | ||
* `napi-v3-darwin-unknown-x64` | ||
* `napi-v3-linux-glibc-arm64` | ||
* `napi-v3-linux-glibc-x64` | ||
* `napi-v3-linux-musl-arm64` | ||
* `napi-v3-linux-musl-x64` | ||
* `napi-v3-win32-unknown-ia32` | ||
* `napi-v3-win32-unknown-x64` | ||
* `napi-v6-darwin-unknown-arm64` | ||
* `napi-v6-darwin-unknown-x64` | ||
* `napi-v6-linux-glibc-arm64` | ||
* `napi-v6-linux-glibc-x64` | ||
* `napi-v6-linux-musl-arm64` | ||
* `napi-v6-linux-musl-x64` | ||
* `napi-v6-win32-unknown-ia32` | ||
* `napi-v6-win32-unknown-x64` | ||
db.each("SELECT rowid AS id, info FROM lorem", function(err, row) { | ||
console.log(row.id + ": " + row.info); | ||
}); | ||
}); | ||
Unfortunately, [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) cannot differentiate between `armv6` and `armv7`, and instead uses `arm` as the `{arch}`. Until that is fixed, you will still need to install `sqlite3` from [source](#source-install). | ||
db.close(); | ||
``` | ||
Support for other platforms and architectures may be added in the future if CI supports building on them. | ||
# Features | ||
If your environment isn't supported, it'll use `node-gyp` to build SQLite but you will need to install a C++ compiler and linker. | ||
- Straightforward query and parameter binding interface | ||
- Full Buffer/Blob support | ||
- Extensive [debugging support](https://github.com/mapbox/node-sqlite3/wiki/Debugging) | ||
- [Query serialization](https://github.com/mapbox/node-sqlite3/wiki/Control-Flow) API | ||
- [Extension support](https://github.com/mapbox/node-sqlite3/wiki/Extensions), including bundled support for the [json1 extension](https://www.sqlite.org/json1.html). | ||
- Big test suite | ||
- Written in modern C++ and tested for memory leaks | ||
- Bundles SQLite3 3.32.3 as a fallback if the installing system doesn't include SQLite | ||
### Other ways to install | ||
It is also possible to make your own build of `sqlite3` from its source instead of its npm package ([See below.](#source-install)). | ||
The `sqlite3` module also works with [node-webkit](https://github.com/rogerwang/node-webkit) if node-webkit contains a supported version of Node.js engine. [(See below.)](#building-for-node-webkit) | ||
SQLite's [SQLCipher extension](https://github.com/sqlcipher/sqlcipher) is also supported. [(See below.)](#building-for-sqlcipher) | ||
# API | ||
See the [API documentation](https://github.com/mapbox/node-sqlite3/wiki) in the wiki. | ||
See the [API documentation](https://github.com/TryGhost/node-sqlite3/wiki/API) in the wiki. | ||
# Installing | ||
# Usage | ||
You can use [`npm`](https://github.com/isaacs/npm) to download and install: | ||
**Note:** the module must be [installed](#installing) before use. | ||
* The latest `sqlite3` package: `npm install sqlite3` | ||
``` js | ||
const sqlite3 = require('sqlite3').verbose(); | ||
const db = new sqlite3.Database(':memory:'); | ||
* GitHub's `master` branch: `npm install https://github.com/mapbox/node-sqlite3/tarball/master` | ||
db.serialize(() => { | ||
db.run("CREATE TABLE lorem (info TEXT)"); | ||
The module uses [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) to download a pre-compiled binary for your platform, if it exists. Otherwise, it uses `node-gyp` to build the extension. | ||
const stmt = db.prepare("INSERT INTO lorem VALUES (?)"); | ||
for (let i = 0; i < 10; i++) { | ||
stmt.run("Ipsum " + i); | ||
} | ||
stmt.finalize(); | ||
It is also possible to make your own build of `sqlite3` from its source instead of its npm package ([see below](#building-from-the-source)). | ||
db.each("SELECT rowid AS id, info FROM lorem", (err, row) => { | ||
console.log(row.id + ": " + row.info); | ||
}); | ||
}); | ||
It is possible to use the installed package in [node-webkit](https://github.com/rogerwang/node-webkit) instead of the vanilla Node.js. See [Building for node-webkit](#building-for-node-webkit) for details. | ||
db.close(); | ||
``` | ||
@@ -82,3 +106,5 @@ ## Source install | ||
npm install --build-from-source | ||
```bash | ||
npm install --build-from-source | ||
``` | ||
@@ -89,3 +115,5 @@ The sqlite3 module depends only on libsqlite3. However, by default, an internal/bundled copy of sqlite will be built and statically linked, so an externally installed sqlite3 is not required. | ||
npm install --build-from-source --sqlite=/usr/local | ||
```bash | ||
npm install --build-from-source --sqlite=/usr/local | ||
``` | ||
@@ -96,24 +124,16 @@ If building against an external sqlite3 make sure to have the development headers available. Mac OS X ships with these by default. If you don't have them installed, install the `-dev` package with your package manager, e.g. `apt-get install libsqlite3-dev` for Debian/Ubuntu. Make sure that you have at least `libsqlite3` >= 3.6. | ||
npm install --build-from-source --sqlite=/usr/local/opt/sqlite/ | ||
```bash | ||
npm install --build-from-source --sqlite=/usr/local/opt/sqlite/ | ||
``` | ||
By default the node-gyp install will use `python` as part of the installation. A | ||
different python executable can be specified on the command line. | ||
npm install --build-from-source --python=/usr/bin/python2 | ||
This uses the npm_config_python config, so values in .npmrc will be honoured: | ||
python=/usr/bin/python2 | ||
## Custom file header (magic) | ||
The default sqlite file header is "SQLite format 3". | ||
You can specify a different magic, though this will make standard tools and libraries unable to work with your files. | ||
The default sqlite file header is "SQLite format 3". You can specify a different magic, though this will make standard tools and libraries unable to work with your files. | ||
```bash | ||
npm install --build-from-source --sqlite_magic="MyCustomMagic15" | ||
``` | ||
npm install --build-from-source --sqlite_magic="MyCustomMagic15" | ||
Note that the magic *must* be exactly 15 characters long (16 bytes including null terminator). | ||
Note that the magic *must* be exactly 15 characters long (16 bytes including null terminator). | ||
## Building for node-webkit | ||
@@ -123,3 +143,3 @@ | ||
To build node-sqlite3 for node-webkit: | ||
To build `sqlite3` for node-webkit: | ||
@@ -130,3 +150,3 @@ 1. Install [`nw-gyp`](https://github.com/rogerwang/nw-gyp) globally: `npm install nw-gyp -g` *(unless already installed)* | ||
```sh | ||
```bash | ||
NODE_WEBKIT_VERSION="0.8.6" # see latest version at https://github.com/rogerwang/node-webkit#downloads | ||
@@ -138,5 +158,5 @@ npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION) | ||
You can also run this command from within a `node-sqlite3` checkout: | ||
You can also run this command from within a `sqlite3` checkout: | ||
```sh | ||
```bash | ||
npm install --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION) | ||
@@ -154,15 +174,15 @@ ``` | ||
## Building for sqlcipher | ||
## Building for SQLCipher | ||
For instructions for building sqlcipher see | ||
[Building SQLCipher for node.js](https://coolaj86.com/articles/building-sqlcipher-for-node-js-on-raspberry-pi-2/) | ||
For instructions on building SQLCipher, see [Building SQLCipher for Node.js](https://coolaj86.com/articles/building-sqlcipher-for-node-js-on-raspberry-pi-2/). Alternatively, you can install it with your local package manager. | ||
To run node-sqlite3 against sqlcipher you need to compile from source by passing build options like: | ||
To run against SQLCipher, you need to compile `sqlite3` from source by passing build options like: | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/ | ||
```bash | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/ | ||
node -e 'require("sqlite3")' | ||
node -e 'require("sqlite3")' | ||
``` | ||
If your sqlcipher is installed in a custom location (if you compiled and installed it yourself), | ||
you'll also need to to set some environment variables: | ||
If your SQLCipher is installed in a custom location (if you compiled and installed it yourself), you'll need to set some environment variables: | ||
@@ -173,7 +193,9 @@ ### On OS X with Homebrew | ||
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib" | ||
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include" | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` | ||
```bash | ||
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib" | ||
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include/sqlcipher" | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` | ||
node -e 'require("sqlite3")' | ||
node -e 'require("sqlite3")' | ||
``` | ||
@@ -184,28 +206,31 @@ ### On most Linuxes (including Raspberry Pi) | ||
export LDFLAGS="-L/usr/local/lib" | ||
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher" | ||
export CXXFLAGS="$CPPFLAGS" | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose | ||
```bash | ||
export LDFLAGS="-L/usr/local/lib" | ||
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher" | ||
export CXXFLAGS="$CPPFLAGS" | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose | ||
node -e 'require("sqlite3")' | ||
node -e 'require("sqlite3")' | ||
``` | ||
### Custom builds and Electron | ||
Running sqlite3 through [electron-rebuild](https://github.com/electron/electron-rebuild) does not preserve the sqlcipher extension, so some additional flags are needed to make this build Electron compatible. Your `npm install sqlite3 --build-from-source` command needs these additional flags (be sure to replace the target version with the current Electron version you are working with): | ||
Running `sqlite3` through [electron-rebuild](https://github.com/electron/electron-rebuild) does not preserve the SQLCipher extension, so some additional flags are needed to make this build Electron compatible. Your `npm install sqlite3 --build-from-source` command needs these additional flags (be sure to replace the target version with the current Electron version you are working with): | ||
--runtime=electron --target=1.7.6 --dist-url=https://electronjs.org/headers | ||
```bash | ||
--runtime=electron --target=18.2.1 --dist-url=https://electronjs.org/headers | ||
``` | ||
In the case of MacOS with Homebrew, the command should look like the following: | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=1.7.6 --dist-url=https://electronjs.org/headers | ||
```bash | ||
npm install sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=18.2.1 --dist-url=https://electronjs.org/headers | ||
``` | ||
# Testing | ||
[mocha](https://github.com/visionmedia/mocha) is required to run unit tests. | ||
```bash | ||
npm test | ||
``` | ||
In sqlite3's directory (where its `package.json` resides) run the following: | ||
npm install mocha | ||
npm test | ||
# Contributors | ||
@@ -226,2 +251,3 @@ | ||
* [Mithgol](https://github.com/Mithgol) | ||
* [Kewde](https://github.com/kewde) | ||
@@ -234,8 +260,12 @@ # Acknowledgments | ||
Development of this module is sponsored by [MapBox](https://mapbox.com/). | ||
This module was originally created by [Mapbox](https://mapbox.com/) & is now maintained by [Ghost](https://ghost.org). | ||
# Changelog | ||
We use [GitHub releases](https://github.com/TryGhost/node-sqlite3/releases) for notes on the latest versions. See [CHANGELOG.md](https://github.com/TryGhost/node-sqlite3/blob/b05f4594cf8b0de64743561fcd2cfe6f4571754d/CHANGELOG.md) in git history for details on older versions. | ||
# License | ||
`node-sqlite3` is [BSD licensed](https://github.com/mapbox/node-sqlite3/raw/master/LICENSE). | ||
`node-sqlite3` is [BSD licensed](https://github.com/tryghost/node-sqlite3/raw/master/LICENSE). | ||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3?ref=badge_large) |
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
3216286
4
0
399
261
23
3