SQLite Forum

In C API, do prepared statements of simple inserts execute repeatedly even if not reset?
The automatic reset happens when you call `sqlite3_step` after the previous `sqlite3_step` returned `SQLITE_DONE`.

The insert statement returns `SQLITE_DONE` right away (since obviously it doesn't have any rows to report), and so every time you call `sqlite3_step`, it's reset and executed anew.

The select statement returns `SQLITE_ROW` on the first call, and positions the cursor to read from the row. On second call, it returns `SQLITE_DONE` indicating that no more rows are available; the cursor is not positioned on any row, so no column data can be extracted (I assume from your description that the resultset consists of a single row). If you were to make the third call, the statement would reset and restart from the beginning, returning `SQLITE_ROW` again.