Reputation: 129
I am trying to look for a good tutorial/jump point to use SQLite in MacOSX App. I do have knowledge in iPhone development but never dealt with SQLite before, all my apps were enterprise lever where i talk to RESTFul server to post and get data, and all the sql stuff is at server side.
All my search attempts returned iphone results and some UI wrappers OSX, i guess there are less people out there that code for OSX than iphone :)
I am trying simply to make my app:
When it runs for the first time, checks and create a DB if it does not exist. I prefer to make the code invoke a sql script that will create the db if it does not exist, or if does exist it can check and make sure all tables, FK relations ..etc are correct. (I know how to do that script I just need the how to invoke in cocoa OSX apps)
Basic SQL stuff. INSERT/UPDATES/DELETE?
But before all this, is SQLite3 the correct approach for MAC OSX apps or I should stay with using plist files? Can the user "Normal" mess the state of SQLite3? are there any permissions issues that i have to worry about? I want my users just to launch the app and I will do everything in the background for them (I know I will support 10.8+ for this)?
Upvotes: 4
Views: 1860
Reputation: 13972
Depending on your data needs you might consider using Core Data. It's not right for every situation, but it might be a good thing to check out. It can store data in XML, sqlite formats on the backend, so you can pick the right format depending on the data characteristics of your app.
If you know you want SQLite directly, FMDB is a good wrapper around it. I used FMDB a few years ago in a Mac app for a client and it worked pretty well.
Even if FMDB isn't your style reading the source may give you a good example of how the sqlite API works.
Upvotes: 4
Reputation: 150615
If you are an iOS developer then you are aware of Core Data, which is probably a better choice than raw SQLite for Mac Applications.
Upvotes: 2