SQLite coding struggles in Mac OSX environment
I am still struggling with coding up my SQLite application. Every tutorial, example, sample code snippets always are directed for iPhone implementation. Is there anyone out there who still enjoys programming on a Mac vs. iPhone that would have sample code I can view to get myself pointed in the right direction?
Part of my issues are related to the SQLAppDelegate routines that I cannot seem to get past the compilation steps. I am seriously contemplating rewriting those snippets differently. I have seen some documentation regarding PROTOCOL and using the delegate feature to perform certain calls.
Please advise.
Thanks,
Jack G.
Jack
How nice to hear from you. I'll look at this after work. I'm still a dinosaur and happy to work on the desktop. Since we last spoke, I've learned a lot more about Cocoa and now it's time for me to revisit Cocoa/SQLite. So hold on, buddy. Help's on it's way.
Thanks Robin. I'm still trying to figure this out for myself. As simple as my solution seems, it still drives me into a fit of confusion with the delegate of the SQL code and the iPhone features. Interesting enough, if I get this functional on the MacBook (or iMac). I will be planning on porting to the iPad. The application is more conducive to that device than the iPhone.
I think the Hillegass book has a tutorial on this.
Jack
Kompilesoft is right - there's a simple CoreData example in Hillegass' book. However the book's index doesn't mention SQLite. Thumbing through the book, I dont see anything about SQLite being used as the persistent data store.
I've started reading this:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/NSPersistentDocumentTutorial.pdf
The tutorial is 71 boring pages long - and like most of Apple's sample applications, it seems rather complex. On the other hand, it's not trivial - so I'm sure the effort to work over this will be worthwhile. In about 90 minutes, I've worked as far as page 25 and been able to create a UI that actually creates and manipulates an SQLite database. And I haven't written a line of code yet. I only had the define the schema and XCode did everything else - including creating a User Interface!
I downloaded "SQLite Database Browser 1.3.app" and he seems happy with the database. And the terminal program sqlite3 can execute SQL on the database. Impressive start.
I couldn't find the sample code on the internet, however it's lurking on my hard drive at:
/Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/samplecode/DepartmentAndEmployees/DepartmentAndEmployees.zip
I'll do more work on this on Saturday. The word delegate appears on page 36. Perhaps I'll get there on Saturday.
Delegate is Apple-speak for a callback object. For example, if you define an application delegate, then that object will be called when various events occur in the application (such as the user wants to quit).
I'll move forward with my study into this and get back to you.
Thanks guys! I will investigate this further. Robin, I appreciate your efforts on this. I will dig through the information that you provided in your latest post and see how I can model that into my application.
Hello Robin,
I was reading through the tutorial you referenced above and found that there appears to be an easier way to tackle my primary issue. As I read through the tutorial, the first thing I came to realize is that I need to re-visit the Data Model for my application. I see where I can remodel the architecture for the database and be able to accomplish what I need differently than what I originally envisioned.
I am going to start there. Let me do that first before you get into any serious time spent further.
I hope you read this before you undertake what you were going to do today. Enjoy your weekend.
Jack
Jack
This sounds fine. Today is my grand-daughter's 4th birthday and my wife is in England at the party. So I'm planning to work this weekend. So thanks for letting me know about your progress, I'm going to deal with some stuff for the office - however I have plenty of time if you need me. You can email me directly at robin@clanmills.com
Good Luck