We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There was a request to generate raw API that throws vs returning the SQLite error code.
E.g. instead of:
func sqlite3_person_insert(_ db: OpaquePointer!, _ record: inout Person) -> Int32
this:
func sqlite3_person_insert(_ db: OpaquePointer!, _ record: inout Person) throws
Even in raw mode Enlighter already generates a nested SQLError structure into the Database structure, which could be used in the throwing versions:
SQLError
Database
public struct Database { public struct SQLError : Swift.Error, Equatable { public let code : Int32 public let message : String?
Documented here: https://lighter-swift.github.io/documentation/lighter/sqliteapi#Handling-Errors
Notably there are raw functions that currently return nil on error and expect the caller to check the db handle for errors on its own. E.g.:
nil
db
public func sqlite3_people_fetch( _ db: OpaquePointer!, sql customSQL: String? = nil, orderBy orderBySQL: String? = nil, limit: Int? = nil ) -> [ Person ]? { ... guard sqlite3_prepare_v2(db, sql, -1, &handle, nil) == SQLITE_OK, let statement = handle else { return nil } ... else if rc != SQLITE_ROW { return nil }
I don't think this is very "hard" to add, but it affects quite a lot of code, i.e. it is quite a bit of work :-)
Created a feature/throwing-raw-1 that adds the option and an insert generator that does sth.
feature/throwing-raw-1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
There was a request to generate raw API that throws vs returning the SQLite error code.
E.g. instead of:
this:
Even in raw mode Enlighter already generates a nested
SQLError
structure into theDatabase
structure, which could be used in the throwing versions:Documented here: https://lighter-swift.github.io/documentation/lighter/sqliteapi#Handling-Errors
Notably there are raw functions that currently return
nil
on error and expect the caller to check thedb
handle for errors on its own. E.g.:I don't think this is very "hard" to add, but it affects quite a lot of code, i.e. it is quite a bit of work :-)
Created a
feature/throwing-raw-1
that adds the option and an insert generator that does sth.The text was updated successfully, but these errors were encountered: