sqlite on iphone can open db but not prepare statements
- by jan
I'm brand new to using sqlite so I may have missed something basic.
I've created a database and copied it into my app's document's directory. I'm able to open it but when I make a call to sqlite3_prepare_v2 I receive SQLITE_ERROR, "SQL error or missing database".
here's my code:
sqlite3 *database;
if(sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK)
{
sqlite3_stmt *compiledStatement;
NSString *sqlStatement = @"select * from dbname";
int result = sqlite3_prepare_v2(database, [sqlStatement UTF8String], -1, &compiledStatement, nil);
...
}
the same sql statement works in the terminal.
I've found this question in a few places either without answers or with solutions that don't fix my problem. I'm hoping someone here will be able to help. Thanks.