How to test SQLite in simulator?

Hello,

I have a db file already created and I want to open it when running the app in the simulator. I tried placing it in the same folder as the app but that is considered the resource directory and I get the error argument #1 to ‘open’ (string expected, got nil). So if I change it to the documents directory where do I put the db file on my computer to read it from there? I have data in the db already that I need to access and read only.

Thanks,

Warren

I actually looked in the sandbox folder for Documents and I saw the db file in there and the size was 0. So I deleted it and copied the file with data in there. Ran the app again and get the error no such table Area. Area is the name of the table with data and it is in there. And there is another copy of the db file in there with 0 size. So two copies are in there. Can anyone tell me what is going on?

Btw I created the db file and db file with .NET and added the data in there that way. Do I have to do it within the app instead?

Here is the code:

--Include sqlite local sqlite3 = require "sqlite3" --Open data.db. If the file doesn't exist it will be created local path = system.pathForFile("Abroad.db", system.DocumentsDirectory) db = sqlite3.open( path )

I tested the code from the documentation and it works where I create the table through the code and populate it that way. I just wish I could populate it first. But I did take that file and load it with a SQLite manager and was able to add data and then use it again in corona. So I guess I will create the tables with corona, populate it myself and then put it back in corona to use which works.

I use SQLiteManager to create and manage my db structure externally to Corona and this works well. I’m sure other tools will work equally well too. 

I actually looked in the sandbox folder for Documents and I saw the db file in there and the size was 0. So I deleted it and copied the file with data in there. Ran the app again and get the error no such table Area. Area is the name of the table with data and it is in there. And there is another copy of the db file in there with 0 size. So two copies are in there. Can anyone tell me what is going on?

Btw I created the db file and db file with .NET and added the data in there that way. Do I have to do it within the app instead?

Here is the code:

--Include sqlite local sqlite3 = require "sqlite3" --Open data.db. If the file doesn't exist it will be created local path = system.pathForFile("Abroad.db", system.DocumentsDirectory) db = sqlite3.open( path )

I tested the code from the documentation and it works where I create the table through the code and populate it that way. I just wish I could populate it first. But I did take that file and load it with a SQLite manager and was able to add data and then use it again in corona. So I guess I will create the tables with corona, populate it myself and then put it back in corona to use which works.

I use SQLiteManager to create and manage my db structure externally to Corona and this works well. I’m sure other tools will work equally well too.