OP-Engineering / op-sqlite

Fastest SQLite library for react-native by @ospfranco
MIT License
598 stars 41 forks source link

ExecuteSql missing for Attaching New SQLite files use case #50

Closed igezt closed 9 months ago

igezt commented 9 months ago

Hello! My team have been experimenting with SQLite libraries for React Native and stumbled upon this library. Thank you for you great work!

Our use case requires us to use multiple SQLite files at once and we notice that you have an 'attach' feature that allows you to attach multiple sqlite files for the same DB connection.

However, currently the db connection object does not return a 'executeSql' function that can be used as seen in the example. Is the example deprecated and if so, is there an updated example on how to use multiple SQLite files?

EduFrazao commented 9 months ago

Hi @igezt. The connection object provides an 'execute' method. This is an error on the docs. I will submit a fix for it. But you can use execute or executeAsync to run querys on your attached database. The example on docs is still valid, only replace 'executeSql' with 'execute' following the pattern with the new database alias and it will work (I use it in production here).

igezt commented 9 months ago

Thank you for the swift response! Much appreciated.