Merge branch 'master' into cleanup-connection-and-statement-types
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
exec/2, exec/3, exec/4,
|
||||
changes/1, changes/2,
|
||||
insert/2,
|
||||
last_insert_rowid/1,
|
||||
get_autocommit/1,
|
||||
get_autocommit/2,
|
||||
prepare/2, prepare/3,
|
||||
@@ -393,6 +394,21 @@ insert(Sql, #connection{raw_connection=RawConnection}, Timeout) ->
|
||||
ok = esqlite3_nif:insert(RawConnection, Ref, self(), Sql),
|
||||
receive_answer(RawConnection, Ref, Timeout).
|
||||
|
||||
%% @doc Get the last insert rowid, using the default timeout.
|
||||
%%
|
||||
-spec last_insert_rowid(connection()) -> {ok, rowid()} | {error, _}.
|
||||
last_insert_rowid(Connection) ->
|
||||
last_insert_rowid(Connection, ?DEFAULT_TIMEOUT).
|
||||
|
||||
%% @doc Get the last insert rowid.
|
||||
%%
|
||||
-spec last_insert_rowid(connection(), timeout()) -> {ok, integer()} | {error, _}.
|
||||
last_insert_rowid({connection, _Ref, Connection}, Timeout) ->
|
||||
Ref = make_ref(),
|
||||
ok = esqlite3_nif:last_insert_rowid(Connection, Ref, self()),
|
||||
receive_answer(Connection, Ref, Timeout).
|
||||
|
||||
%% @doc Get autocommit
|
||||
%% @doc Check if the connection is in auto-commit mode.
|
||||
%% See: [https://sqlite.org/c3ref/get_autocommit.html] for more details.
|
||||
%%
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
exec/4,
|
||||
changes/3,
|
||||
insert/4,
|
||||
last_insert_rowid/3,
|
||||
get_autocommit/3,
|
||||
prepare/4,
|
||||
multi_step/5,
|
||||
@@ -152,6 +153,12 @@ close(_Db, _Ref, _Dest) ->
|
||||
insert(_Db, _Ref, _Dest, _Sql) ->
|
||||
erlang:nif_error(nif_library_not_loaded).
|
||||
|
||||
%% @doc Get the last insert rowid.
|
||||
%%
|
||||
%% @spec insert(connection(), Ref::reference(), Dest::pid()) -> {ok, integer()} | {error, message()}
|
||||
last_insert_rowid(_Db, _Ref, _Dest) ->
|
||||
erlang:nif_error(nif_library_not_loaded).
|
||||
|
||||
%% @doc Get automcommit
|
||||
%%
|
||||
-spec get_autocommit(raw_connection(), reference(), pid()) -> ok | {error, _}.
|
||||
|
||||
Reference in New Issue
Block a user