[Pkg-javascript-commits] [node-sqlite3] 03/06: New upstream version 3.1.8+ds1
Jérémy Lal
kapouer at moszumanska.debian.org
Wed Dec 21 10:42:19 UTC 2016
This is an automated email from the git hooks/post-receive script.
kapouer pushed a commit to branch master
in repository node-sqlite3.
commit ecc4af6718be0c70cb934e4b4f9c58b6034d21ba
Author: Jérémy Lal <kapouer at melix.org>
Date: Wed Dec 21 11:38:09 2016 +0100
New upstream version 3.1.8+ds1
---
.eslintrc.js | 12 +++++
.travis.yml | 13 ++++-
CHANGELOG.md | 19 +++++++
README.md | 1 +
appveyor.yml | 26 ++++++----
deps/common-sqlite.gypi | 2 +-
deps/sqlite3.gyp | 4 ++
lib/sqlite3.js | 15 +++---
lib/trace.js | 1 -
package.json | 125 +++++++++++++++++++++++----------------------
scripts/build-appveyor.bat | 14 +++++
scripts/build-local.bat | 2 +-
src/async.h | 11 ----
src/database.cc | 20 ++++++++
src/database.h | 4 ++
test/interrupt.test.js | 80 +++++++++++++++++++++++++++++
16 files changed, 255 insertions(+), 94 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 0000000..0804367
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,12 @@
+module.exports = {
+ "extends": "eslint:recommended",
+ "env": {
+ "node": true
+ },
+ "rules": {
+ "indent": ["error", 4],
+ "linebreak-style": ["error", "unix"],
+ "semi": ["error", "always"],
+ "no-cond-assign": ["error", "always"]
+ }
+}
diff --git a/.travis.yml b/.travis.yml
index 429dd4b..1bc6f8e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,13 @@ matrix:
# Linux
- os: linux
compiler: clang
+ env: NODE_VERSION="7"
+ addons:
+ apt:
+ sources: [ 'ubuntu-toolchain-r-test','llvm-toolchain-precise-3.5', 'gcc-multilib', 'g++-multilib', 'libsqlite3-dev:i386' ]
+ packages: [ 'clang-3.5']
+ - os: linux
+ compiler: clang
env: NODE_VERSION="6"
addons:
apt:
@@ -60,7 +67,7 @@ matrix:
# test building against external sqlite
- os: linux
compiler: clang
- env: NODE_VERSION="0.10.40" EXTERNAL_SQLITE=true PUBLISHABLE=false
+ env: NODE_VERSION="0.10" EXTERNAL_SQLITE=true PUBLISHABLE=false
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test','llvm-toolchain-precise-3.5', 'gcc-multilib', 'g++-multilib', 'libsqlite3-dev:i386' ]
@@ -71,6 +78,9 @@ matrix:
env: NODE_VERSION="5" COVERAGE=true PUBLISHABLE=false # node abi 47
- os: osx
compiler: clang
+ env: NODE_VERSION="7" # node abi 51
+ - os: osx
+ compiler: clang
env: NODE_VERSION="6" # node abi 48
- os: osx
compiler: clang
@@ -121,5 +131,6 @@ before_script:
script:
- if [[ "${NODE_VERSION}" ]]; then ./scripts/build_against_node.sh; fi;
+- if [[ "${NODE_VERSION}" -eq "4" ]]; then ./node_modules/.bin/eslint lib; fi;
# disabled for now: need to port to sudo:false
#- if [[ "${NODE_WEBKIT}" ]]; then ./scripts/build_against_node_webkit.sh; fi;
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2bcf12c..509b481 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,24 @@
# Changelog
+## 3.1.8
+
+- Added support for node v7 (pre-compiled binaries available)
+
+## 3.1.7
+
+- Upgrade sqlite to 3.15, enable FTS4, FTS5 (@wmertens)
+- Upgrade to node-pre-gyp at 0.6.31 and nan at 2.4.0
+
+## 3.1.6
+
+- Starts bundling node-pre-gyp again to avoid #720
+
+## 3.1.5
+
+- [Added support for sqlite3_interrupt](https://github.com/mapbox/node-sqlite3/pull/518): this makes
+ it possible to interrupt a long-running query.
+- [Fixes uv_ref race](https://github.com/mapbox/node-sqlite3/pull/705).
+
## 3.1.4
- Added support for node v6
diff --git a/README.md b/README.md
index 6f755fd..8aa9482 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,7 @@ db.close();
- [Extension support](https://github.com/mapbox/node-sqlite3/wiki/Extensions)
- Big test suite
- Written in modern C++ and tested for memory leaks
+ - Bundles Sqlite3 3.9.1 as a fallback if the installing system doesn't include SQLite
# API
diff --git a/appveyor.yml b/appveyor.yml
index 1f63dab..f250183 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,34 +4,40 @@ environment:
node_pre_gyp_secretAccessKey:
secure: 1amwJJw9fu0j6dXnc5KsAQbSYf7Cjw/dapT6OZWABa6nc52grkKeLQ+DGaOfQz8i
matrix:
- - nodejs_version: 0.10.40
+ - nodejs_version: 0.10
platform: x86
msvs_toolset: 12
- - nodejs_version: 0.10.40
+ - nodejs_version: 0.10
platform: x64
msvs_toolset: 12
- - nodejs_version: 0.12.7
+ - nodejs_version: 0.12
platform: x86
msvs_toolset: 12
- - nodejs_version: 0.12.7
+ - nodejs_version: 0.12
platform: x64
msvs_toolset: 12
- - nodejs_version: 4.0.0
+ - nodejs_version: 4
+ platform: x64
+ msvs_toolset: 12
+ - nodejs_version: 4
+ platform: x86
+ msvs_toolset: 12
+ - nodejs_version: 5
platform: x64
msvs_toolset: 12
- - nodejs_version: 4.0.0
+ - nodejs_version: 5
platform: x86
msvs_toolset: 12
- - nodejs_version: 5.0.0
+ - nodejs_version: 6
platform: x64
msvs_toolset: 12
- - nodejs_version: 5.0.0
+ - nodejs_version: 6
platform: x86
msvs_toolset: 12
- - nodejs_version: 6.0.0
+ - nodejs_version: 7
platform: x64
msvs_toolset: 12
- - nodejs_version: 6.0.0
+ - nodejs_version: 7
platform: x86
msvs_toolset: 12
# custom visual studio 2015 builds
diff --git a/deps/common-sqlite.gypi b/deps/common-sqlite.gypi
index 1148aa6..35ab835 100644
--- a/deps/common-sqlite.gypi
+++ b/deps/common-sqlite.gypi
@@ -1,6 +1,6 @@
{
'variables': {
- 'sqlite_version%':'3090100',
+ 'sqlite_version%':'3150000',
"toolset%":'',
},
'target_defaults': {
diff --git a/deps/sqlite3.gyp b/deps/sqlite3.gyp
index 45a6423..80d0632 100755
--- a/deps/sqlite3.gyp
+++ b/deps/sqlite3.gyp
@@ -80,6 +80,8 @@
'defines': [
'SQLITE_THREADSAFE=1',
'SQLITE_ENABLE_FTS3',
+ 'SQLITE_ENABLE_FTS4',
+ 'SQLITE_ENABLE_FTS5',
'SQLITE_ENABLE_JSON1',
'SQLITE_ENABLE_RTREE'
],
@@ -92,6 +94,8 @@
'_REENTRANT=1',
'SQLITE_THREADSAFE=1',
'SQLITE_ENABLE_FTS3',
+ 'SQLITE_ENABLE_FTS4',
+ 'SQLITE_ENABLE_FTS5',
'SQLITE_ENABLE_JSON1',
'SQLITE_ENABLE_RTREE'
],
diff --git a/lib/sqlite3.js b/lib/sqlite3.js
index 466b902..e3a570c 100644
--- a/lib/sqlite3.js
+++ b/lib/sqlite3.js
@@ -19,12 +19,12 @@ function normalizeMethod (fn) {
}
var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args);
- }
+ };
}
function inherits(target, source) {
- for (var k in source.prototype)
- target.prototype[k] = source.prototype[k];
+ for (var k in source.prototype)
+ target.prototype[k] = source.prototype[k];
}
sqlite3.cached = {
@@ -34,17 +34,18 @@ sqlite3.cached = {
return new Database(file, a, b);
}
+ var db;
file = path.resolve(file);
+ function cb() { callback.call(db, null); }
if (!sqlite3.cached.objects[file]) {
- var db =sqlite3.cached.objects[file] = new Database(file, a, b);
+ db = sqlite3.cached.objects[file] = new Database(file, a, b);
}
else {
// Make sure the callback is called.
- var db = sqlite3.cached.objects[file];
+ db = sqlite3.cached.objects[file];
var callback = (typeof a === 'number') ? b : a;
if (typeof callback === 'function') {
- function cb() { callback.call(db, null); }
if (db.open) process.nextTick(cb);
else db.once('open', cb);
}
@@ -114,7 +115,7 @@ Statement.prototype.map = function() {
} else {
var value = keys[1];
// Value is a plain value
- for (var i = 0; i < rows.length; i++) {
+ for (i = 0; i < rows.length; i++) {
result[rows[i][key]] = rows[i][value];
}
}
diff --git a/lib/trace.js b/lib/trace.js
index 3ea20bd..987f38a 100644
--- a/lib/trace.js
+++ b/lib/trace.js
@@ -1,5 +1,4 @@
// Inspired by https://github.com/tlrobinson/long-stack-traces
-var EventEmitter = require('events').EventEmitter;
var util = require('util');
function extendTrace(object, property, pos) {
diff --git a/package.json b/package.json
index f650dd7..f669ecf 100644
--- a/package.json
+++ b/package.json
@@ -1,64 +1,65 @@
{
- "name": "sqlite3",
- "description": "Asynchronous, non-blocking SQLite3 bindings",
- "version": "3.1.4",
- "homepage": "http://github.com/mapbox/node-sqlite3",
- "author": {
- "name": "MapBox",
- "url": "https://mapbox.com/"
- },
- "binary": {
- "module_name" : "node_sqlite3",
- "module_path" : "./lib/binding/{node_abi}-{platform}-{arch}",
- "host" : "https://mapbox-node-binary.s3.amazonaws.com",
- "remote_path" : "./{name}/v{version}/{toolset}/",
- "package_name": "{node_abi}-{platform}-{arch}.tar.gz"
- },
- "contributors": [
- "Konstantin Käfer <mail at kkaefer.com>",
- "Dane Springmeyer <dane at mapbox.com>",
- "Will White <will at mapbox.com>",
- "Orlando Vazquez <ovazquez at gmail.com>",
- "Artem Kustikov <kustikoff at gmail.com>",
- "Eric Fredricksen <efredricksen at gmail.com>",
- "John Wright <mrjjwright at gmail.com>",
- "Ryan Dahl <ry at tinyclouds.org>",
- "Tom MacWright <tom at mapbox.com>",
- "Carter Thaxton <carter.thaxton at gmail.com>",
- "Audrius Kažukauskas <audrius at neutrino.lt>",
- "Johannes Schauer <josch at pyneo.org>",
- "Nathan Rajlich <nathan at tootallnate.net>",
- "AJ ONeal <coolaj86 at gmail.com>",
- "Mithgol",
- "Ben Noordhuis <ben at strongloop.com>"
- ],
- "repository": {
- "type": "git",
- "url": "git://github.com/mapbox/node-sqlite3.git"
- },
- "dependencies": {
- "nan": "~2.3.3",
- "node-pre-gyp": "~0.6.28"
- },
- "bundledDependencies": [
- "node-pre-gyp"
- ],
- "devDependencies": {
- "mocha": "2.x",
- "aws-sdk": "2.x"
- },
- "scripts": {
- "prepublish":"npm ls",
- "install": "node-pre-gyp install --fallback-to-build",
- "pretest": "node test/support/createdb.js",
- "test": "mocha -R spec --timeout 480000"
- },
- "license": "BSD-3-Clause",
- "keywords": [
- "sql",
- "sqlite",
- "sqlite3",
- "database"
- ],
- "main": "./lib/sqlite3"
+ "name": "sqlite3",
+ "description": "Asynchronous, non-blocking SQLite3 bindings",
+ "version": "3.1.8",
+ "homepage": "http://github.com/mapbox/node-sqlite3",
+ "author": {
+ "name": "MapBox",
+ "url": "https://mapbox.com/"
+ },
+ "binary": {
+ "module_name": "node_sqlite3",
+ "module_path": "./lib/binding/{node_abi}-{platform}-{arch}",
+ "host": "https://mapbox-node-binary.s3.amazonaws.com",
+ "remote_path": "./{name}/v{version}/{toolset}/",
+ "package_name": "{node_abi}-{platform}-{arch}.tar.gz"
+ },
+ "contributors": [
+ "Konstantin Käfer <mail at kkaefer.com>",
+ "Dane Springmeyer <dane at mapbox.com>",
+ "Will White <will at mapbox.com>",
+ "Orlando Vazquez <ovazquez at gmail.com>",
+ "Artem Kustikov <kustikoff at gmail.com>",
+ "Eric Fredricksen <efredricksen at gmail.com>",
+ "John Wright <mrjjwright at gmail.com>",
+ "Ryan Dahl <ry at tinyclouds.org>",
+ "Tom MacWright <tom at mapbox.com>",
+ "Carter Thaxton <carter.thaxton at gmail.com>",
+ "Audrius Kažukauskas <audrius at neutrino.lt>",
+ "Johannes Schauer <josch at pyneo.org>",
+ "Nathan Rajlich <nathan at tootallnate.net>",
+ "AJ ONeal <coolaj86 at gmail.com>",
+ "Mithgol",
+ "Ben Noordhuis <ben at strongloop.com>"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mapbox/node-sqlite3.git"
+ },
+ "dependencies": {
+ "nan": "~2.4.0",
+ "node-pre-gyp": "~0.6.31"
+ },
+ "bundledDependencies": [
+ "node-pre-gyp"
+ ],
+ "devDependencies": {
+ "aws-sdk": "2.x",
+ "eslint": "3.5.0",
+ "mocha": "3.x"
+ },
+ "scripts": {
+ "prepublish": "npm ls",
+ "install": "node-pre-gyp install --fallback-to-build",
+ "pretest": "node test/support/createdb.js",
+ "test": "mocha -R spec --timeout 480000"
+ },
+ "license": "BSD-3-Clause",
+ "keywords": [
+ "sql",
+ "sqlite",
+ "sqlite3",
+ "database"
+ ],
+ "main": "./lib/sqlite3"
}
diff --git a/scripts/build-appveyor.bat b/scripts/build-appveyor.bat
index eceb1c4..0205089 100644
--- a/scripts/build-appveyor.bat
+++ b/scripts/build-appveyor.bat
@@ -42,6 +42,20 @@ IF /I "%platform%"=="x64" powershell Install-Product node $env:nodejs_version x6
IF /I "%platform%"=="x86" powershell Install-Product node $env:nodejs_version x86
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
+SET NODE_MAJOR=%nodejs_version:~0,1%
+ECHO node major version^: %NODE_MAJOR%
+IF %NODE_MAJOR% GTR 0 ECHO node version greater than zero, not updating npm && GOTO SKIP_APPVEYOR_INSTALL
+
+powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
+IF %ERRORLEVEL% NEQ 0 GOTO ERROR
+CALL npm install --global --production npm-windows-upgrade
+IF %ERRORLEVEL% NEQ 0 GOTO ERROR
+REM https://ci.appveyor.com/project/Mapbox/node-sqlite3/build/1.0.500/job/n2y9fo4eg316db56#L289
+REM error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers
+REM at least 2.15.9 is needed: https://github.com/nodejs/node-gyp/issues/972#issuecomment-231055109
+CALL npm-windows-upgrade --npm-version 2.15.9 --no-dns-check --no-prompt
+IF %ERRORLEVEL% NEQ 0 GOTO ERROR
+
:SKIP_APPVEYOR_INSTALL
IF /I "%msvs_toolset%"=="12" GOTO NODE_INSTALLED
diff --git a/scripts/build-local.bat b/scripts/build-local.bat
index 2f3b751..615aa4a 100644
--- a/scripts/build-local.bat
+++ b/scripts/build-local.bat
@@ -38,7 +38,7 @@ IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO ============================
ECHO VS2015
ECHO ============================
-SET nodejs_version=4.4.1
+SET nodejs_version=0.10.40
ECHO SET nodejs_version^: %nodejs_version%
SET platform=x64
ECHO SET platform^: %platform%
diff --git a/src/async.h b/src/async.h
index 2b167ce..5232c12 100644
--- a/src/async.h
+++ b/src/async.h
@@ -36,11 +36,6 @@ public:
rows.swap(async->data);
NODE_SQLITE3_MUTEX_UNLOCK(&async->mutex)
for (unsigned int i = 0, size = rows.size(); i < size; i++) {
-#if NODE_VERSION_AT_LEAST(0, 7, 9)
- uv_unref((uv_handle_t *)&async->watcher);
-#else
- uv_unref(uv_default_loop());
-#endif
async->callback(async->parent, rows[i]);
}
}
@@ -61,12 +56,6 @@ public:
}
void add(Item* item) {
- // Make sure node runs long enough to deliver the messages.
-#if NODE_VERSION_AT_LEAST(0, 7, 9)
- uv_ref((uv_handle_t *)&watcher);
-#else
- uv_ref(uv_default_loop());
-#endif
NODE_SQLITE3_MUTEX_LOCK(&mutex);
data.push_back(item);
NODE_SQLITE3_MUTEX_UNLOCK(&mutex)
diff --git a/src/database.cc b/src/database.cc
index 5f1e197..e7891cb 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -23,6 +23,7 @@ NAN_MODULE_INIT(Database::Init) {
Nan::SetPrototypeMethod(t, "serialize", Serialize);
Nan::SetPrototypeMethod(t, "parallelize", Parallelize);
Nan::SetPrototypeMethod(t, "configure", Configure);
+ Nan::SetPrototypeMethod(t, "interrupt", Interrupt);
NODE_SET_GETTER(t, "open", OpenGetter);
@@ -224,6 +225,8 @@ void Database::Work_BeginClose(Baton* baton) {
assert(baton->db->pending == 0);
baton->db->RemoveCallbacks();
+ baton->db->closing = true;
+
int status = uv_queue_work(uv_default_loop(),
&baton->request, Work_Close, (uv_after_work_cb)Work_AfterClose);
assert(status == 0);
@@ -249,6 +252,8 @@ void Database::Work_AfterClose(uv_work_t* req) {
Baton* baton = static_cast<Baton*>(req->data);
Database* db = baton->db;
+ db->closing = false;
+
Local<Value> argv[1];
if (baton->status != SQLITE_OK) {
EXCEPTION(Nan::New(baton->message.c_str()).ToLocalChecked(), baton->status, exception);
@@ -351,6 +356,21 @@ NAN_METHOD(Database::Configure) {
info.GetReturnValue().Set(info.This());
}
+NAN_METHOD(Database::Interrupt) {
+ Database* db = Nan::ObjectWrap::Unwrap<Database>(info.This());
+
+ if (!db->open) {
+ return Nan::ThrowError("Database is not open");
+ }
+
+ if (db->closing) {
+ return Nan::ThrowError("Database is closing");
+ }
+
+ sqlite3_interrupt(db->_handle);
+ info.GetReturnValue().Set(info.This());
+}
+
void Database::SetBusyTimeout(Baton* baton) {
assert(baton->db->open);
assert(baton->db->_handle);
diff --git a/src/database.h b/src/database.h
index 8aeabfd..c5455ab 100644
--- a/src/database.h
+++ b/src/database.h
@@ -103,6 +103,7 @@ protected:
Database() : Nan::ObjectWrap(),
_handle(NULL),
open(false),
+ closing(false),
locked(false),
pending(0),
serialize(false),
@@ -151,6 +152,8 @@ protected:
static NAN_METHOD(Configure);
+ static NAN_METHOD(Interrupt);
+
static void SetBusyTimeout(Baton* baton);
static void RegisterTraceCallback(Baton* baton);
@@ -171,6 +174,7 @@ protected:
sqlite3* _handle;
bool open;
+ bool closing;
bool locked;
unsigned int pending;
diff --git a/test/interrupt.test.js b/test/interrupt.test.js
new file mode 100644
index 0000000..708f4ca
--- /dev/null
+++ b/test/interrupt.test.js
@@ -0,0 +1,80 @@
+var sqlite3 = require('..');
+var assert = require('assert');
+
+describe('interrupt', function() {
+ it('should interrupt queries', function(done) {
+ var interrupted = false;
+ var saved = null;
+
+ var db = new sqlite3.Database(':memory:', function() {
+ db.serialize();
+
+ var setup = 'create table t (n int);';
+ for (var i = 0; i < 8; i += 1) {
+ setup += 'insert into t values (' + i + ');';
+ }
+
+ db.exec(setup, function(err) {
+ if (err) {
+ return done(err);
+ }
+
+ var query = 'select last.n ' +
+ 'from t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t as last';
+
+ db.each(query, function(err) {
+ if (err) {
+ saved = err;
+ } else if (!interrupted) {
+ interrupted = true;
+ db.interrupt();
+ }
+ });
+
+ db.close(function() {
+ if (saved) {
+ assert.equal(saved.message, 'SQLITE_INTERRUPT: interrupted');
+ assert.equal(saved.errno, sqlite3.INTERRUPT);
+ assert.equal(saved.code, 'SQLITE_INTERRUPT');
+ done();
+ } else {
+ done(new Error('Completed query without error, but expected error'));
+ }
+ });
+ });
+ });
+ });
+
+ it('should throw if interrupt is called before open', function(done) {
+ var db = new sqlite3.Database(':memory:');
+
+ assert.throws(function() {
+ db.interrupt();
+ }, (/Database is not open/));
+
+ db.close();
+ done();
+ });
+
+ it('should throw if interrupt is called after close', function(done) {
+ var db = new sqlite3.Database(':memory:');
+
+ db.close(function() {
+ assert.throws(function() {
+ db.interrupt();
+ }, (/Database is not open/));
+
+ done();
+ });
+ });
+
+ it('should throw if interrupt is called during close', function(done) {
+ var db = new sqlite3.Database(':memory:', function() {
+ db.close();
+ assert.throws(function() {
+ db.interrupt();
+ }, (/Database is closing/));
+ done();
+ });
+ });
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/node-sqlite3.git
More information about the Pkg-javascript-commits
mailing list