What does the insertion expression do in SQLite return if successful?
I always thought it should be SQLITE_DONE, but recently in my logs I found the following line:
sqlite3_step error: 'not an error'
And here is the code that registers the specified string:
prepareStatement(addTranslationStmt2, "INSERT INTO translations(lang1_wordid, lang2_wordid) VALUES(?, ?)");
if (!addTranslationStmt2) return -2;
sqlite3_bind_int(addTranslationStmt2, 1, word_id);
sqlite3_bind_int(addTranslationStmt2, 2, translation_id);
if(sqlite3_step(addTranslationStmt2) != SQLITE_DONE)
{
NSLog(@"sqlite3_step error: '%s'", sqlite3_errmsg(database));
sqlite3_reset(addTranslationStmt2);
return -1;
}
sqlite3_reset(addTranslationStmt2);
I wonder why this works in most cases. Should I change SQLITE_DONE in my code to SQLITE_OK?
Thanks.
source
share