Implement get_autocommit

http://www.sqlite.org/c3ref/get_autocommit.html
This commit is contained in:
connor rigby
2018-12-02 11:10:03 -08:00
parent 2dd24c5381
commit d014a4d525
4 changed files with 74 additions and 2 deletions

View File

@@ -26,6 +26,8 @@
exec/2, exec/3,
changes/1, changes/2,
insert/2,
get_autocommit/1,
get_autocommit/2,
prepare/2, prepare/3,
step/1, step/2,
reset/1,
@@ -293,6 +295,17 @@ insert(Sql, {connection, _Ref, Connection}, Timeout) ->
ok = esqlite3_nif:insert(Connection, Ref, self(), Sql),
receive_answer(Ref, Timeout).
%% @doc Get autocommit
%%
%% @spec get_autocommit(connection) -> true | false
get_autocommit(Connection) ->
get_autocommit(Connection, ?DEFAULT_TIMEOUT).
get_autocommit({connection, _Ref, Connection}, Timeout) ->
Ref = make_ref(),
ok = esqlite3_nif:get_autocommit(Connection, Ref, self()),
receive_answer(Ref, Timeout).
%% @doc Prepare a statement
%%
%% @spec prepare(iolist(), connection()) -> {ok, prepared_statement()} | {error, error_message()}