Hi
I’am wondering … if I need to save data only for unlock levels (no score , no points) do I have to use sqlite (with is hard to understand for me ) or is the another way like txt file.?
[import]uid: 13156 topic_id: 7250 reply_id: 307250[/import]
You are right it’s very useful to know how to implement SQL so I’am fighting with sql.
Maybe you can tell me … the db file i will see in my folder or it’s hidden? I want to “restart” my sql database and I don’t know how because I can not find the db file.
[import]uid: 13156 topic_id: 7250 reply_id: 25492[/import]
Technically the db file is saved where you tell the code to save it, but you’re probably saving to system.DocumentsDirectory and that folder isn’t in an obvious place with the simulator. The docs indicate that folder is your user Documents folder ~/Documents but that is incorrect; it’s actually saved in the application sandbox indicated in Terminal. Took me a little rooting around yesterday to figure out the docs are wrong and it was actually saved in ~/Library/Application Support/Corona Simulator/etc. [import]uid: 12108 topic_id: 7250 reply_id: 25493[/import]
You can just stick the data in a text file, that’s the easiest way. Using SQL is a more robust solution for data storage however, and it’s a useful standard to know. Because I wanted to learn SQL anyway I decided to use SQLite in my current project even though I’ve never used SQL before.
Just this morning I added a comment onto the database API page with links to a couple resources I found yesterday:
http://developer.anscamobile.com/content/data-storage [import]uid: 12108 topic_id: 7250 reply_id: 25491[/import]
Yes I found this. Ok in general where I supposed to store this file?
This file will be added automatically during compilation ? [import]uid: 13156 topic_id: 7250 reply_id: 25495[/import]
system.DocumentsDirectory is the best place to save it, since that location is the best (only?) one to use on device. It’s just that in the simulator it’s not obvious where that saves to. Now that you’ve found it though then there’s no more problem. [import]uid: 12108 topic_id: 7250 reply_id: 25498[/import]
thank you jhocking [import]uid: 13156 topic_id: 7250 reply_id: 25499[/import]
jhocking you are amazing!!!
[import]uid: 40538 topic_id: 7250 reply_id: 36510[/import]
The easiest way to find the Docs directory is from the Corona file menu, just select “Show Project Sandbox”
You could also save it to the Temporary directory on the device however that would probably negate the point of saving to a database. [import]uid: 5833 topic_id: 7250 reply_id: 36530[/import]
I didn’t know that Graham. I always went the long way. [import]uid: 31262 topic_id: 7250 reply_id: 36545[/import]
SQLite is not too bad bad to pick up, just started using it for an app myself to save state. I also added a comment to the API page above with a link to a graphical tool that helps when learning. [import]uid: 8692 topic_id: 7250 reply_id: 36550[/import]
@ aaaron - You’re welcome, it can make things easier. [import]uid: 5833 topic_id: 7250 reply_id: 36562[/import]
I wish they would update the API page with the correct folder details - this was the most frustrating thing. [import]uid: 40538 topic_id: 7250 reply_id: 36575[/import]