On Tue, Feb 1, 2011 at 3:38 AM, Tito Ciuro <tci...@mac.com> wrote: > Hello, > > The following code snippet runs fine on Mac OS X, but fails on the iOS > simulator: > > // Obtain a path for the database > NSString *docs = > [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, > YES) lastObject]; > NSString *path = [[docs stringByAppendingPathComponent:@ > "myDB.sqlite"]fileSystemRepresentation]; > > // Open the database > sqlite3 *db = NULL; > int statusOpen = sqlite3_open_v2( fileSystemRepresentation, &db, > SQLITE_OPEN_READWRITE | > SQLITE_OPEN_CREATE | SQLITE_OPEN_AUTOPROXY | SQLITE_OPEN_FULLMUTEX, NULL); >
Do you need UTF8String for the sqlite3_open_v2() ? > > // Build the first statement > sqlite3_stmt *oneStatement = NULL; > const char *oneSQL = [[NSString stringWithFormat:@"INSERT INTO %@(%@, > %@, %@, %@) VALUES (?,?,?,?);", NSFValues, NSFKey, NSFAttribute, NSFValue, > NSFDatatype]UTF8String]; > int statusOne = sqlite3_prepare_v2(db, oneSQL, (int)strlen(oneSQL), > &oneStatement, &oneSQL); > > > // Build the second statement > sqlite3_stmt *twoStatement = NULL; > const char *twoSQL = [[NSString stringWithFormat:@"INSERT INTO %@(%@, > %@, %@, %@) VALUES (?,?,?,?);", NSFKeys, NSFKey, NSFPlist, NSFCalendarDate, > NSFObjectClass]UTF8String]; > int statusTwo = sqlite3_prepare_v2(db, twoSQL, (int)strlen(twoSQL), > &twoStatement, &twoSQL); > > What I see is that statusTwo returns 1, and I have no idea why. What is > really puzzling is that if I open the database in memory or temporary mode, > it works fine in both Mac OS X and iOS! > > So my question I have is, why would the second sqlite3_prepare_v2 statement > fail only on path-based iOS apps? :-/ > > Thanks in advance, > > -- Tito > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users