Git Product home page Git Product logo

Comments (16)

msfstef avatar msfstef commented on June 12, 2024

@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.

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@msfstef use the transitionBegin, transitionCommit see transition doc

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@msfstef i saw that you use API34 which is not compatible with Capacitor5

from sqlite.

msfstef avatar msfstef commented on June 12, 2024

Opened PR for this: #527

@jepiqueau we need to use the executeSet run and query for everything for flexibility

from sqlite.

msfstef avatar msfstef commented on June 12, 2024

@msfstef i saw that you use API34 which is not compatible with Capacitor5

I don't think that's related to this issue - clearly this parsing being done here is failing for a valid statement type?

from sqlite.

ygarg465 avatar ygarg465 commented on June 12, 2024

@msfstef i saw that you use API34 which is not compatible with Capacitor5

This also occurs with API level 33

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@msfstef have you look at the doc provide iin v5.6.3 this is full tested. Are you working with @ygarg465 if yes please can only one register the issue it and follow it up it will be less confusion for me. Provide me a full code on github so i can add the case you are using

from sqlite.

msfstef avatar msfstef commented on June 12, 2024

@msfstef have you look at the doc provide iin v5.6.3 this is full tested. Are you working with @ygarg465 if yes please can only one register the issue it and follow it up it will be less confusion for me. Provide me a full code on github so i can add the case you are using

Both @ygarg465 and I are trying to unblock the usage of the driver with ElectricSQL - currently running the statement BEGIN fails because of the lines mentioned by @ygarg465 above and it can be fixed with this PR.

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 BEGIN statement and you should get the error.

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@msfstef OK i understand i will have a look

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@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

from sqlite.

msfstef avatar msfstef commented on June 12, 2024

@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 substring(0,6) is still a bit problematic and the same statements should be able to run with the run API as well, so fixing this issue I think is still important

from sqlite.

ygarg465 avatar ygarg465 commented on June 12, 2024

@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 substring(0,6) is still a bit problematic and the same statements should be able to run with the run API as well, so fixing this issue I think is still important

I agree as substring(0,6) is not the best way to extract the statement type.

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@msfstef i will add to the documentation

  • SQLite Data Definition Language commands (CREATE, ALTER, DROP) and the SQLite Transaction Control commands (BEGIN TRANSACTION, COMMIT, ROLLBACK) must used execute method.
  • SQLite Data Manipulation Language commands (INSERT, UPDATE, DELETE, REPLACE) must used run method if they have bind values and can use execute or run methods if they do not have bind values.
  • SQLite Data Query Language commands (SELECT) must used query method.

Will this clarify how to use the capacitor-community/sqlite plugin

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@msfstef Can i close the issue, i will reject the PR if you now agree

from sqlite.

msfstef avatar msfstef commented on June 12, 2024

@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 run only for the 4 DML commands.

Either way my issue is unblocked through using execute so feel free to close.

from sqlite.

jepiqueau avatar jepiqueau commented on June 12, 2024

@msfstef @ygarg465 thanks for your understanding this is the way i develop the software i must have put this at the early stage of développement. This will have avoid mis-understanding and waste of time for developers

from sqlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.