capacitor-community / sqlite

Community plugin for native & electron SQLite databases
MIT License
426 stars 104 forks source link

Electron Platform SQL92 false generates invalid SQL query #518

Closed ygarg465 closed 2 months ago

ygarg465 commented 2 months ago

Describe the bug Calling the query method of the library on the electron platform generates an invalid SQL query when having the isSQL92 parameter equal to false.

The generated query has the table name and 'WHERE' clause having no space between them.

Desktop (please complete the following information):

Additional context whereSQL92 method in UtilsSQL92Compatibility class

I think this is also causing this problem where we are passing different cased isSQL92 property to the method.

@jepiqueau can you take a look at this.

Thanks

jepiqueau commented 2 months ago

@ygarg465 this could happen as the wrapper is certainly not exhaustive. This is the reason why your queries must be SQL92 compatible specially if it is a new application. What was your query which failed

ygarg465 commented 2 months ago

@jepiqueau this was the sql query which failed with isSQL92 = true

SELECT version FROM _electric_migrations
        WHERE version != '0'
        ORDER BY version DESC
        LIMIT 1
jepiqueau commented 2 months ago

@ygarg465 this must be fixed in v5.6.1-1

ygarg465 commented 2 months ago

@jepiqueau Looks good 👍

jepiqueau commented 2 months ago

@ygarg465 thanks for the feedback