Skip to content

Releases: vapor/sqlite-nio

Update min Swift version to 5.6 and make platform versions consistent

14 Apr 00:57
fb7e739
Compare
Choose a tag to compare

Patch SQLite to silence spurious C warnings and fix data race in sqlite3_last_insert_rowid()

23 Mar 11:06
a22db45
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

The patch is automatically applied when updating SQLite and is carefully designed to be as minimal as possible.

Embed sqlite amalgamation v3.41.2 source code

23 Mar 10:05
babbf08
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

Update embedded SQLite from 3.41.1 to 3.41.2 (SQLite release notes)

fix: No longer fatal errors on inactive thread pool

17 Mar 15:47
766d6cc
Compare
Choose a tag to compare
This patch was authored by @NeedleInAJayStack and released by @gwynne.

Previously, trying to open a connection on an inactive thread pool would throw Fatal error: leaking promise created at (file: "SQLiteNIO/SQLiteConnection.swift", line: 101). This was because the promise created on line 101 of SQLiteConnection.swift would not be succeeded or failed when the runIfActive was called on an inactive thread pool. To resolve this, we avoid creating a new Promise altogether, just using the one that runIfActive provides.

Embed SQLite 3.41.1, add string datetime support, and support custom functions

13 Mar 05:56
596b680
Compare
Choose a tag to compare

Add support for datetime string formats by @NeedleInAJayStack

Previously, dates were only interpreted from Double or Int SQLite representations, which caused issues with decoding values of CURRENT_DATE and CURRENT_TIMESTAMP, which output formatted strings. This PR adds support to interpret dates from strings, matching the formats output by the date() and datetime() SQLite functions, which includes the CURRENT_DATE and CURRENT_TIMESTAMP constants.

SQLite Custom Functions are now supported by @danramteke

This PR adds custom function support to sqlite-nio. Both custom functions and custom aggregates are supported. To find out more about these features, please see the SQLite website about them: https://www.sqlite.org/appfunc.html

There are some queries only possible using custom functions. And further, custom function help soften the need for custom builds of SQLite with various parts of the SQLite amalgamation enabled or disabled: one can simply write a custom function instead.

I have adapted this code from https://github.com/groue/GRDB.swift/blob/master/GRDB/Core/DatabaseFunction.swift by @groue. Because GRDB doesn't support Linux or NIO, I was motivated to adapt his code.

Example:

func testFunctionArgumentString() throws {
	let conn = try SQLiteConnection.open(storage: .memory, threadPool: self.threadPool, on: self.eventLoop).wait()
	defer { try! conn.close().wait() }
	let fn = SQLiteCustomFunction("f", argumentCount: 1) { (values: [SQLiteData]) in
		return values[0].string
	}
	try conn.install(customFunction: fn).wait()
	XCTAssertNil(try conn.query("SELECT f(NULL) as result")
								.map { rows in rows[0].column("result")?.string }.wait())
	XCTAssertEqual("foo", try conn.query("SELECT f('foo') as result")
									.map { rows in rows[0].column("result")?.string }.wait())
}

There are many more examples in the new unit test file.

Embed sqlite amalgamation v3.41.1 source code by @gwynne

Update embedded SQLite from 3.41.0 to 3.41.1 (SQLite release notes)

Embed sqlite amalgamation v3.41.0 source code

22 Feb 16:09
0c5014e
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

Update embedded SQLite from 3.40.0 to 3.40.1 (SQLite release notes)

Revert warning flags change

30 Jan 06:51
88a7a57
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

SwiftPM does not want it to be possible to work around Xcode's abysmal quality control. Oh well 🙂.

Fixes #38

Fix SQLite build configuration

28 Jan 06:56
c81248b
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

SQLite is now build with the intended thread safety configuration.

Warnings emitted when building in Xcode (due to Xcode not matching SwiftPM's default compiler flags) are now silenced.

Embed sqlite amalgamation v3.40.1 source code

25 Jan 09:45
294c713
Compare
Choose a tag to compare
This patch was authored and released by @gwynne.

Update embedded SQLite from 3.40.0 to 3.40.1 (SQLite release notes)

Embed sqlite amalgamation v3.40.0 source code

04 Dec 22:58
3b93e0a
Compare
Choose a tag to compare
This patch was authored by @Austinpayne and released by @gwynne.

This PR removes dependence on a system libsqlite3 by embedding the amalgamation (single source file) release of sqlite3 in vendored form. The included source code is fetched from https://sqlite.org/download.html. (#35)

Projects which include logic in their Dockerfile and/or CI workflows to ensure that the libsqlite3-dev package (or equivalent) is installed on the build image can now safely remove it, but are not required to do so. No additional actions are necessary to take advantage of any additional features supported by the embedded library; SQLKit and Fluent will detect their availability automatically when possible (most notably UPSERTsupport).

Closes #32