Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does sqlite3_prepare_v2 == FALSE?
    primarykey
    data
    text
    <p>Not sure why sqlite3_prepare_v2 equals false. I've searched around online and couldn't find much and what I did find didn't help. One site suggested to using sqlite3_errmsg(database) and this outputted "not an error" for some reason. Another answer online suggested deleting a folder in the iPhone simulator which is named with a string hex, but that didn't work either. I made my database and dropped into the supporting files folder so it is there and it has records.</p> <p>This is my code:</p> <pre><code>-(void)readMovesFromDatabaseWithPath:(NSString *)filePath { sqlite3 *database; printf("Here in readMovesFromDatabaseWithPath\n"); if(sqlite3_open([filePath UTF8String], &amp;database) == SQLITE_OK) { NSLog(@"Now in readMovesFromDatabaseWithPath\n"); const char *sqlStatement = "select * from moves"; sqlite3_stmt *compiledStatment; printf( "could not prepare statemnt: %s\n", sqlite3_errmsg(database) ); //returns "not an error" if(sqlite3_prepare_v2(database, sqlStatement, -1, &amp;compiledStatment, NULL) == SQLITE_OK) { NSLog(@"In sqlite3_prepare_v2 block\n"); //does not reach this line while(sqlite3_step(compiledStatment) == SQLITE_ROW) //Loops through the database { //Extracts the move's name NSString *moveName = [NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatment, 1)]; //Extracts the move's description NSString *moveDescription = [NSString stringWithUTF8String:(char *) sqlite3_column_text(compiledStatment, 2)]; //Creates new move objects Moves *newMove = [[Moves alloc] init]; newMove.moveName = moveName; newMove.moveDescription = moveDescription; [self.moves addObject:newMove]; } } sqlite3_finalize(compiledStatment); } sqlite3_close(database); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload