SQLite Forum

Feature request: expose additional state to identify left-open statements
Login
`sqlite3_stmt_busy` returns whether or not the statement is `busy`, that is, in the middle of being executed.

That is, a `statement` is a `row generator function`.  When `sqlite3_stmt_busy` returns True that means that the row generator function has been called at least once and has returned an interim result, but has not yet run to completion.  (That is, it is holding at least a read lock on the database).

To be more clear, if `sqlite3_stmt_busy` returns true then the statement has been stepped since it was last reset (or created) and has not been stepped to completion.  Once the statement is stepped to completion (or reset) `sqlite3_stmt_busy` will return false.

In your description, if a statement returns true (is busy) then you can reset the statement.  If badly written code (yours or someone else's) is ill-behaved then you should swat them with a clue-by-four and have them use the three seashells more effectively ...