https://kotlinlang.org logo
v

Vinod Rai

02/19/2021, 6:56 AM
Hi All, 1. There is a requirement in my KMM project to use the existing database file in common code using SQLDelight like the .db file we use from assets in android. how I can do this? 2. I wish to access the JSON text from the file stored locally, parse it & return in the response in case of Network/API failure. Is there any way to do this? Thanks in advance!
m

Mustafa Ozhan

02/19/2021, 8:16 AM
Hello, I had same issue I couldn’t find an solution, but I found a work around, If your database is not so huge you can open your asset with sqllitebrowser and then you can export the neccessary tables as blabla.sqlite then you will be able to add
INSERT INTO
commands like here https://github.com/CurrencyConverterCalculator/CCC/blob/master/common/src/commonMain/database/com/github/mustafaozhan/ccc/common/sql/Currency.sq
v

Vinod Rai

02/19/2021, 11:43 AM
Thanks, but I have 1000 or more records in table
m

Mustafa Ozhan

02/19/2021, 12:43 PM
I see.. please let me know also if you find something, I would like to change my implementation too if possible 🙂
22 Views