• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
sqlite iphone question....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sqlite iphone question....


  • Subject: sqlite iphone question....
  • From: James Cicenia <email@hidden>
  • Date: Fri, 23 Jan 2009 11:30:03 -0600

Hello -

I am trying to get my simulator to work with sqlite and was wondering if I was missing some step?

Here is a snippet of code:

- (void)initializeDatabase {
	NSMutableArray *items = [[NSMutableArray alloc] init];
	self.produceItems = items;
	[items release];

// The database is stored in the application bundle.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sqlite"];


// Open the database. The database was prepared outside the application.
if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
NSLog(@"Open Database");
// Get the primary key for all produce.
const char *sql = "SELECT id FROM Item";
sqlite3_stmt *statement;
// Preparing a statement compiles the SQL query into a byte- code program in the SQLite library.
// The third parameter is either the length of the SQL string or -1 to read up to the first null terminator.
if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {


NEVER GETS PAST THIS IF. I have queried the database and the data is in there?!

Thanks
James Cicenia
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: sqlite iphone question....
      • From: Keith Duncan <email@hidden>
    • Re: sqlite iphone question....
      • From: Keary Suska <email@hidden>
  • Prev by Date: Sliding Split Views, part II
  • Next by Date: Re: Getting iPod icon, was Getting the network Machine Icon
  • Previous by thread: Re: Sliding Split Views, part II
  • Next by thread: Re: sqlite iphone question....
  • Index(es):
    • Date
    • Thread