On 27/05/2011, at 12:49 AM, john darnell wrote: > I am still trying to get SQLite to work on my Mac. I want to make sure I am > doing what I should be doing.
Here's a simple answer: 1. Add the sqlite library to your target's build phase. 2. Add an Objective C wrapper class to your project, such as the one by "Matteo Bertozzi": http://th30z.blogspot.com/2008/11/objective-c-sqlite-wrapper_8445.html 2.1 Download the Sqlite.h and SQLite.m files 2.2 Add them to your project. 3. To call SQLite from your code, simply import the Sqlite wrapper class and use either the executeNonQuery or executeQuery method. The executeQuery method returns an array of dictionaries: #import "Sqlite.h" Sqlite* sqlite = [[Sqlite alloc] initWithFile:@"path to file"]; NSArray* resultDictArray = [sqlite executeQuery:@"select Name, Quantity from Ingredients order by Name"]; [sqlite executeNonQuery:@"delete from Ingredients where Name = 'squash'"]; [sqlite close]; It's best to create the sqlite object as an ivar within your class, and release it in your class's dealloc. I presented this recently at a CocoaHeads meeting. You can view the slideshow here: http://www.barefeetware.com/sqlite/iosxcode/?ml Tom BareFeetWare -- Comparison of SQLite GUI tools: http://www.barefeetware.com/sqlite/compare/?ml _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users