better-sqlite3
Advanced tools
Comparing version 0.8.2 to 0.9.0
@@ -6,8 +6,8 @@ 'use strict'; | ||
function Database(filename, options) { | ||
if (typeof filename !== 'string') { | ||
function Database(filenameGiven, options) { | ||
if (typeof filenameGiven !== 'string') { | ||
throw new TypeError('Expected argument 0 to be a string filename.'); | ||
} | ||
filename = filename.trim(); | ||
var filename = filenameGiven.trim(); | ||
if (typeof options !== 'object' || options === null) { | ||
@@ -39,3 +39,3 @@ options = {}; | ||
return new CPPDatabase(filename, NullFactory); | ||
return new CPPDatabase(filename, filenameGiven, NullFactory); | ||
} | ||
@@ -42,0 +42,0 @@ CPPDatabase.prototype.constructor = Database; |
{ | ||
"name": "better-sqlite3", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "The fastest and most carefully designed library for SQLite3 in Node.js.", | ||
@@ -19,3 +19,6 @@ "homepage": "http://github.com/JoshuaWise/better-sqlite3", | ||
"chai": "^3.5.0", | ||
"mocha": "^3.0.2" | ||
"cli-color": "^1.1.0", | ||
"fs-extra": "^0.30.0", | ||
"mocha": "^3.0.2", | ||
"sqlite3": "^3.1.4" | ||
}, | ||
@@ -26,3 +29,4 @@ "scripts": { | ||
"pretest": "rm -r ./temp/ || true && mkdir ./temp/", | ||
"posttest": "rm -r ./temp/" | ||
"posttest": "rm -r ./temp/", | ||
"benchmark": "node benchmark" | ||
}, | ||
@@ -29,0 +33,0 @@ "license": "MIT", |
@@ -32,3 +32,3 @@ # better-sqlite3 | ||
- `node-sqlite3` uses asynchronous APIs for tasks that don't touch the hard disk. That's not only bad besign, but it wastes tons of resources. | ||
- `node-sqlite3` forces you to manage the memory of SQLite3 statements yourself. `better-sqlite3` does it the JavaScript way, allowing the garbage collector to worry about memory management. | ||
- `node-sqlite3` exposes low-level (C language) memory management functions. `better-sqlite3` does it the JavaScript way, allowing the garbage collector to worry about memory management. | ||
- This module secretly splits your database connectino into two parts; a read-only connection, and a writable connection, which gives you completely atomic transactions and protects you from reading uncommitted data. | ||
@@ -87,2 +87,6 @@ | ||
### *get* .filename -> string | ||
Returns the string used to open the databse connection. | ||
## class *Statement* | ||
@@ -89,0 +93,0 @@ |
@@ -8,3 +8,3 @@ var expect = require('chai').expect; | ||
expect(function () {db.pragma('cache_size');}).to.throw(Error); | ||
}) | ||
}); | ||
it('should throw an exception if a string is not provided', function (done) { | ||
@@ -20,3 +20,3 @@ var db = new Database('temp/12.2.db'); | ||
}); | ||
}) | ||
}); | ||
it('should throw an exception if invalid/redundant SQL is provided', function (done) { | ||
@@ -28,3 +28,3 @@ var db = new Database('temp/12.3.db'); | ||
}); | ||
}) | ||
}); | ||
it('should execute the pragma, returning rows of strings', function (done) { | ||
@@ -57,2 +57,9 @@ var db = new Database('temp/12.4.db'); | ||
}); | ||
it('should return undefined when no rows exist and simpler results are desired', function (done) { | ||
var db = new Database('temp/12.7.db'); | ||
db.on('open', function () { | ||
expect(db.pragma('table_info', true)).to.be.undefined; | ||
done(); | ||
}); | ||
}); | ||
}); |
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
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
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
2618825
114
770
274
5
2
3