Releases: WiseLibs/better-sqlite3
v4.1.1
A bug was fixed that was making it difficult for many Windows users to install the package.
v4.0.1
- Replaced the
Statement#each()
method with the new (and much more powerful)Statement#iterate()
method. - Support for Node.js versions below 6.0.0 have been dropped.
v3.3.0
SQLite3 extensions are now supported. See the docs to learn how to use them.
v3.2.0
The database constructor now supports the fileMustExist
option.
v3.1.0
Added the db.inTransaction getter, allowing you to check if the database connection is currently in an open transaction.
v3.0.3
The bundled sqlite3 engine has been upgraded to version 3.19.3.
v3.0.0
This major version provides some powerful new features, introduces a better API for some functions, and comes with many small performance enhancements.
Breaking changes
- readonly mode has been reimplemented to use sqlite's engine-level readonly mode, instead of being implemented at the library level.
Database#pragma()
has been reworked to return proper result types (instead of just strings), and now works properly with readonly mode.Database#checkpoint()
has been completely reworked. It now accepts different arguments and has a different return value. By default, it now checkpoints all attached databases instead of just the main database. To learn how to use it, click here.- The
Database.Int64
class has been replaced byDatabase.Integer
which is a reference to the self-contained integer package.Database.Integer
has a very different API from the oldDatabase.Int64
, and provides many powerful features and utilities. Read about it here. - All boolean options (like
new Database(options.readonly)
orstatement.pluck(newState)
) must beboolean
if provided. Previously, they used the truthiness of whatever was provided, but now the provided value must either betrue
,false
, or omitted. An error will be thrown if a non-boolean value is provided.
Non-breaking new features
- The bundled sqlite3 engine has been upgraded to version 3.19.2.
- When an sqlite3-related error is thrown, it will be an
SqliteError
, which is a subclass ofError
, and has acode
property that corresponds to a result code.- This allows you to do checks like
if (err.code === 'SQLITE_CONSTRAINT_UNIQUE')
- The
SqliteError
class is available atDatabase.SqliteError
- This allows you to do checks like
Database#register()
now accepts generator functions, which registers a custom aggregate SQL function. To learn how to use them, read here.
Bug fixes and other minor improvements
- The
nan
package dependency has been removed, slightly improving performance. - When more than 4294967295 rows are returned by
Statement#all()
, an error is thrown instead of corrupting the results returned from the database (this is the maximumarray.length
in nodejs). - You can now use a combination of multiple prefixes (
$foo
,:foo
,@foo
) when creating a statement or transaction with named parameters. Previously this would result in errors being thrown. - The
Statement#bind()
andTransaction#bind()
methods can now be used even if the query was previously executed. - The performance of binding named parameters has been significantly improved.
- Many other minor performance enhancements.
Expected issues
The installation process has been completely rewritten, so I expect there to be installation issues when using Windows and/or Electron. If an issue like this comes up, please open an issue and I'll fix it as soon as possible.
v2.3.3
v2.3.1
v2.3.0
This release fixes a few minor bugs, significantly improves overall performance, and introduces the db.register()
method, which allows you to define custom SQL functions.
0d4e336 added the db.register() method, allowing you to register custom SQL functions
f3daddb prepared statements and transactions can now be reused even after the table schema changes
6fff040 pluck() and safeIntegers() can no longer be invoked within an each() callback function