• 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
Re: Why doesn't this work on my device?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't this work on my device?


  • Subject: Re: Why doesn't this work on my device?
  • From: Bill Bumgarner <email@hidden>
  • Date: Fri, 27 Feb 2009 08:35:57 -0800

On Feb 27, 2009, at 7:56 AM, James Cicenia wrote:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sql"];

int cntv = 0;
int cntf = 0;

ProduceItem *item=nil;
if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
// Get the primary key for all books.
const char *sql = "SELECT type, subtype, name, id FROM ProduceItem ORDER BY name";
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {


It does get to the second If statement so it did find the database. But then evidently it is not SQLITE_OK on my device in regards to that last if.

Have you checked to see if the file at path actually exists?

The documentation for sqlite3_open() indicates that it will quite happily create a band new empty database if one doesn't exist at the path.

Have a look at the SQLite Book List example (http://developer.apple.com/iphone/library/samplecode/SQLiteBooks/listing4.html ) as it demonstrates testing for the database file and then copying it into the writable location, as necessary.

b.bum


_______________________________________________

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: Why doesn't this work on my device?
      • From: James Cicenia <email@hidden>
References: 
 >Why doesn't this work on my device? (From: James Cicenia <email@hidden>)
 >Re: Why doesn't this work on my device? (From: Jason Foreman <email@hidden>)
 >Re: Why doesn't this work on my device? (From: James Cicenia <email@hidden>)
 >Re: Why doesn't this work on my device? (From: Bill Bumgarner <email@hidden>)
 >Re: Why doesn't this work on my device? (From: James Cicenia <email@hidden>)
 >Re: Why doesn't this work on my device? (From: Bill Bumgarner <email@hidden>)
 >Re: Why doesn't this work on my device? (From: James Cicenia <email@hidden>)
 >Re: Why doesn't this work on my device? (From: Bill Bumgarner <email@hidden>)
 >Re: Why doesn't this work on my device? (From: James Cicenia <email@hidden>)
 >Re: Why doesn't this work on my device? (From: Michael Ash <email@hidden>)
 >Re: Why doesn't this work on my device? (From: James Cicenia <email@hidden>)
 >Re: Why doesn't this work on my device? (From: Bill Bumgarner <email@hidden>)
 >Re: Why doesn't this work on my device? (From: James Cicenia <email@hidden>)

  • Prev by Date: Re: NSOutlineView - a way to adjust column widths without a header?
  • Next by Date: Re: Why doesn't this work on my device?
  • Previous by thread: Re: Why doesn't this work on my device?
  • Next by thread: Re: Why doesn't this work on my device?
  • Index(es):
    • Date
    • Thread