-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A minor overhaul #68
A minor overhaul #68
Conversation
…. General docs cleanup.
…s when being decoded, make `Double` and `Float` accept integer values, use recommended APIs for translating between ByteBuffer and Data
… error handling. Make sure statements get finalized when errors occur. Use sqlite3_bind_blob64() and sqlite3_bind_text64() instead of the 32-bit ones. Simplify reading of blob data.
…dd set of async assertions. Make tests resilient against array index range violations. Handle blobs more sensibly instead of torturing Data. Get rid of lots of force-unwraps. Use "throws error" assertion instead of messy do/catch clauses. Avoid crashing if opening a DB fails. Use singleton thread pool and MTELG always.
Codecov ReportAttention: Patch coverage is
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
|
…convenience methods. Factor out the `open()` implementation so the core part can be shared by the ELF and async versions. Don't leak sqlite3* handles if sqlite3_busy_handler() fails for some reason. Throw more specific errors from `open()`. Don't log at error level. Use the async version of NIOThreadPool.runIfActive() when possible.
…tion's async methods together.
…n_v2(), so there's no point in setting multithread mode as the default during compilation; use serialized as the default instead.
…entation, plus omitting several APIs that aren't usable through this package anyway.
…y default (security hardening). Provide an initializer flag to override it if needed.
The dependents test will not pass without the fix to FluentSQLiteDriver to account for the extended result codes in the |
@@ -54,6 +55,33 @@ public struct SQLiteError: Error, CustomStringConvertible, LocalizedError { | |||
case warning | |||
case row | |||
case done | |||
|
|||
// SQLite "extended" result codes | |||
case errorMissingCollatingSequence, errorRetry, errorMissingSnapshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Urgh, we need a blanket ban on enums in the next major releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, you know, the core team could finally listen to people about the need to solve this problem 🤨
These changes are now available in 1.9.0
Numerous improvements have been made to SQLiteNIO's functionality:
String
s,Float
s, andDouble
s via theSQLiteDataConvertible
path (this primarily affects FluentSQLiteDriver and SQLiteKit), integer and real values are now converted to strings, and integer values are now converted to floats or doubles. Previously such conversions would be rejected.EventLoopFuture
-based APIs now have explicitasync
counterparts, which in most cases saves at least a couple of excess thread hops. (This shows particular benefits inSQLiteKit
- or rather, it will once Leverage improvements in SQLKit and SQLiteNIO sqlite-kit#108 lands.)SQLiteConnection.open()
.SQLiteConnection.open()
now throws more useful, less generic errors.nil
values would previously cause a crash, the failure is now handled gracefully.Sendable
correctness has been implemented. In particular,SQLiteDatabase
is nowSendable
.CSQLite
target available to downstream packages, this should not affect users functionally, and may slightly improve performance and output binary size.SQLITE_DIRECTONLY
by default; this can be changed by passingindirect: true
to theSQLiteCustomFunction
initializer if needed.SQLiteError
now recognizes and uses SQLite's more specific "extended" result codes.NIOThreadPool.singleton
andMultiThreadedEventLoopGroup.singleton
unless otherwise specified.