sqlite-nio
sqlite-nio copied to clipboard
Improve data handling for strings and blobs, plus general cleanup
Several improvements have been made to SQLiteNIO's functionality:
- Less copying (rarely, a lot less copying) around of blobs happens.
- When decoding
Strings via theSQLiteDataConvertiblepath (this primarily affects FluentSQLiteDriver and SQLiteKit), integer and real values are now converted to strings rather than being rejected. - When decoding
Floats andDoubles via theSQLiteDataConvertiblepath (this primarily affects FluentSQLiteDriver and SQLiteKit), integer values are now converted to the appropriate type rather than being rejected. - The minimum supported Swift version is now 5.8.
- All
EventLoopFuture-based APIs now have explicitasynccounterparts. - SQLite statement handles are now finalized correctly after encountering error conditions, which should reduce general memory usage a little.
- SQLite connection handles are no longer leaked when certain errors occur during
SQLiteConnection.open(). -
SQLiteConnection.open()now throws more useful, less generic errors. - Strings and binary blobs larger than 4GB are now supported.
- A few places where the code would previously crash on unexpectedly nil values now handle the failures gracefully.
- Further
Sendablecorrectness has been implemented. - Async APIs avoid excess thread hopping between event loops and tasks whenever possible.
- We now omit several SQLite features that aren't usable through SQLiteNIO anyway.
- Custom user functions are now
SQLITE_DIRECTONLYby default; this can be changed by passingindirect: trueto theSQLiteCustomFunctioninitializer if needed.
Codecov Report
Attention: Patch coverage is 55.09138% with 172 lines in your changes are missing coverage. Please review.
Project coverage is 65.60%. Comparing base (
2102da7) to head (575470b). Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #68 +/- ##
==========================================
+ Coverage 65.03% 65.60% +0.57%
==========================================
Files 8 9 +1
Lines 675 756 +81
==========================================
+ Hits 439 496 +57
- Misses 236 260 +24
| Files | Coverage Δ | |
|---|---|---|
| Sources/SQLiteNIO/SQLiteDataType.swift | 0.00% <ø> (ø) |
|
| Sources/SQLiteNIO/SQLiteRow.swift | 64.28% <100.00%> (ø) |
|
| Sources/SQLiteNIO/SQLiteData.swift | 75.00% <50.00%> (+1.50%) |
:arrow_up: |
| Sources/SQLiteNIO/SQLiteStatement.swift | 95.06% <93.61%> (+5.58%) |
:arrow_up: |
| Sources/SQLiteNIO/SQLiteCustomFunction.swift | 82.48% <70.00%> (-1.20%) |
:arrow_down: |
| Sources/SQLiteNIO/SQLiteDataConvertible.swift | 58.62% <30.43%> (-2.30%) |
:arrow_down: |
| Sources/SQLiteNIO/SQLiteConnection.swift | 68.51% <63.15%> (+0.24%) |
:arrow_up: |
| Sources/SQLiteNIO/SQLiteDatabase.swift | 30.00% <30.00%> (ø) |
|
| Sources/SQLiteNIO/SQLiteError.swift | 48.98% <49.73%> (+22.17%) |
:arrow_up: |
The dependents test will not pass without the fix to FluentSQLiteDriver to account for the extended result codes in the DatabaseError conformance, but that is not a blocker for this PR.