Make sure the statement is reset after a in step. Fixes #10

This commit is contained in:
Maas-Maarten Zeeman
2014-06-16 22:24:59 +02:00
parent d0fb9156a8
commit 6428cec6dd
4 changed files with 153 additions and 13 deletions

View File

@@ -27,6 +27,7 @@
insert/2,
prepare/2, prepare/3,
step/1, step/2,
reset/1,
bind/2, bind/3,
fetchone/1,
fetchall/1,
@@ -270,6 +271,14 @@ step(Stmt, Timeout) ->
ok = esqlite3_nif:step(Stmt, Ref, self()),
receive_answer(Ref, Timeout).
%% @doc Reset the prepared statement back to its initial state.
%%
%% @spec reset(prepared_statement()) -> ok | {error, error_message()}
reset(Stmt) ->
Ref = make_ref(),
ok = esqlite3_nif:reset(Stmt, Ref, self()),
receive_answer(Ref, ?DEFAULT_TIMEOUT).
%% @doc Bind values to prepared statements
%%
%% @spec bind(prepared_statement(), value_list()) -> ok | {error, error_message()}