-
Notifications
You must be signed in to change notification settings - Fork 107
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
Bug(Android): Calling run
method with BEGIN
statement throws StringOutOfBoundIndexException
#526
Comments
@jepiqueau this is a bit of a blocker for running transactions using the Capacitor driver on Android - the above solution has been tested and it indeed resolves the issue. |
@msfstef use the transitionBegin, transitionCommit see transition doc |
@msfstef i saw that you use API34 which is not compatible with Capacitor5 |
Opened PR for this: #527 @jepiqueau we need to use the |
I don't think that's related to this issue - clearly this parsing being done here is failing for a valid statement type? |
This also occurs with API level 33 |
Both @ygarg465 and I are trying to unblock the usage of the driver with ElectricSQL - currently running the statement I understand that you have a transaction API (I looked at the doc you mentioned) but for the sake of interoperability with multiple SQLite drivers we prefer to just be able to run SQLite statements and manage the rest on our side. For reproducing the issue you can just run a |
@msfstef OK i understand i will have a look |
@msfstef why do not use execute in tha case it will work. Run is more for insert, replace, update, delete which have all 6 characters for the command and is made when you have a statement with or without values to bind |
@jepiqueau you're right that for those particular statements with no bind values we can bypass the prepared statement route, good idea! Will have an immediate fix using that. That being said, the parsing of the command with the arbitrary |
I agree as |
@msfstef i will add to the documentation
Will this clarify how to use the capacitor-community/sqlite plugin |
…1052) Using the `execute` API rather than the `run` one for when no bind values are provided as it has less pre-processing and solves a parsing issue that `run` has for statements like `BEGIN` and `ROLLBACK`. Not strictly necessary but provides an immediate solution to a bug that is blocking the use of this driver on Android without requiring changes from the driver side. See this issue: capacitor-community/sqlite#526
@msfstef Can i close the issue, i will reject the PR if you now agree |
@jepiqueau sure - I still think the current parsing method of the command is a bit arbitrary and error-prone, but I understand that you want to support Either way my issue is unblocked through using |
…1052) Using the `execute` API rather than the `run` one for when no bind values are provided as it has less pre-processing and solves a parsing issue that `run` has for statements like `BEGIN` and `ROLLBACK`. Not strictly necessary but provides an immediate solution to a bug that is blocking the use of this driver on Android without requiring changes from the driver side. See this issue: capacitor-community/sqlite#526
Describe the bug
To start the transaction using the
BEGIN
statement results inError: Run: begin 0, end 6, length 5
on Android.This is because of StringOutOfBoundException thrown on this line.
A possible solution provided by @msfstef
Expected behaviour
It should extract the statements of less than 6 characters without any exception being thrown.
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: