私はコードを持っています:
if (sqlite3_open([dbPath UTF8String], &db) == SQLITE_OK)
{
const char *sql_stmt = "create table contacts (id integer primary key autoincrement, name text, address text, phone text);";
if (sqlite3_exec(db, sql_stmt, NULL, NULL, NULL) == SQLITE_OK)
{
av = [[UIAlertView alloc] initWithTitle:@"Success!!!" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
}
else
{
av = [[UIAlertView alloc] initWithTitle:@"Error3" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
}
} else {
av = [[UIAlertView alloc] initWithTitle:@"Error2" message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
}
sqlite3_execに到達しましたが、終了コード26が返されます:データベースファイルではないファイルが開かれました。もしそうなら、なぜifステートメントが実行されるのでしょうか?
前もって感謝します。