sqlite on iphone can open db but not prepare statements
Posted
by jan
on Stack Overflow
See other posts from Stack Overflow
or by jan
Published on 2010-04-04T01:01:23Z
Indexed on
2010/04/04
1:03 UTC
Read the original article
Hit count: 562
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.
© Stack Overflow or respective owner