SQLite Forum

Confused about sqlite3_step / sqlite_reset / sqlite3_bind_xxx APIs
Thank you for your reply.

Well, I'm actually trying to isolate the SQLite logic into a dedicated module, I just see a difference between "execute query" (DQL) which returns a cursor to iterate on (SQLITE_ROW/SQLITE_DONE logic), and "execute update" (DML) which directly returns SQLITE_DONE or an error. In both case I also intend to reuse the prepared statements and redo the binding at each query.

I indeed understand that just calling sqlite3_reset() after each query won't harm and seems to be "the way". However, I'm confused about the special scenario where sqlite3_step() returned an error (like SQLITE_CONSTRAINT), then the next sqlite3_reset() is also returning an error (insead of SQLITE_OK as you wrote). Will sqlite3_reset() always return the same error as the previous sqlite3_step()? It's not so clear in the documentation...

Thanks again.