Czy „wstaw” w SQLite zwraca SQLITE_OK lub SQLITE_DONE?
Co w instrukcji SQLite zwraca „powrót” w przypadku sukcesu?
Zawsze wierzyłem, że powinien to być SQLITE_DONE, ale ostatnio w moich dziennikach odkryłem następujący ciąg:
<code>sqlite3_step error: 'not an error' </code>
A oto kod, który rejestruje wspomniany ciąg:
<code>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); </code>
Zastanawiam się, dlaczego to działa w większości przypadków. Czy należy zmienić SQLITE_DONE w moim kodzie na SQLITE_OK?
Dzięki.