Fix force try in the `FailableIterator.next()` and `Connection.prepare()` methods
The force try is crashing and ideally, the prepare() query should throw the error rather than crashing the app. Thanks!
Thanks for taking the time to submit a pull request.
Before submitting, please do the following:
- Run
make lintto check if there are any format errors (install swiftlint first) - Run
swift testto see if the tests pass. - Write new tests for new functionality.
- Update documentation comments where applicable.
anyone please merge this request?
Why don't you just use prepareRowIterator instead of prepare?
Why don't you just use
prepareRowIteratorinstead ofprepare?
I don't understand the question. The prepare() method is a publicly exposed method that is included in the README as an example usage of the library.
I notice this line was reverted from try? in the past, this may be the reason #1075 and the previous fix pr is #1030
I notice this line was reverted from
try?in the past, this may be the reason #1075 and the previous fix pr is #1030
If you read through the comments for why:
#1030 - Don't crash and documentation should be updated.
#1075 - Revert the change b/c it causes an error in prepare().
Note that the documentation was never updated to tell users that "If you use this method that we included in the library and use in the example README, then it can cause your production to app crash". Seems to me that there are two solutions to this:
- Mark the method as unavailable and don't implement the
Iteratorprotocol. OR - Fix it by making the
next()method adhere to the protocol and fixingprepare()(which can throw errors) to usefailableNext()instead.
I chose Option 2. It's up to those who still use this fork of the repo to decide if they want to accept the fix - I would certainly suggest that if the community would like to keep people from forking off and maintaining their own forks, then "just use a different method that is not in the documented README" is not a solution.
FWIW, anyone who wants this fix is welcome to use my client's fork: https://github.com/BiAffectBridge/SQLite.swift
any update?
Any update?