Skip to content

Commit

Permalink
Prepare minor release 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
max-au committed Feb 21, 2023
1 parent a427a89 commit 4bbc1f9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,13 @@ escript.exe rebar3 ct
```
## Missing Features for 1.0
* implement correct handling for sqlite BUSY and LOCKED return codes
* do "trylock" and then reschedule instead of dirty NIF from the beginning
* yielding busy handler (instead of consuming dirty I/O scheduler)
* asynchronous `query` and `execute` APIs (with message exchange on return)
* add diagnostic routines to enumerate prepared statements/statements running
* performance: use "trylock" and then reschedule instead of dirty NIF from the beginning
* performance: transparently handle BUSY and LOCKED instead of busy wait in dirty scheduler
* asynchronous APIs (using message exchange, e.g. for `query` and `execute`)
* diagnostic routines to enumerate prepared statements/statements running
## Features beyond 1.0
These features did not make it into 1.0, but are useful and may be implemented
These features will not make it into 1.0, but are useful and may be implemented
in the following releases:
* non-experimental sqlite hooks support (commit, preupdate, rollback, update, wal)
* sqlite snapshot, vfs, blob and serialization support
Expand Down
2 changes: 1 addition & 1 deletion src/sqlite.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, sqlite,
[{description, "sqlite: NIF bindings for Erlang"},
{vsn, "0.5.0"},
{vsn, "0.6.0"},
{registered, []},
{applications, [kernel, stdlib]},
{env, []},
Expand Down
18 changes: 9 additions & 9 deletions src/sqlite.erl
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ nif_stub_error(Line) ->
-type prepared_statement() :: reference().
%% Prepared statement reference.

-type column_type() :: integer | float | binary.
%% SQLite column type mapped to an Erlang type.

-type column_name() :: binary().
%% Column name

-type parameter() :: integer() | float() | binary() | string() | iolist() | {binary, binary()} | undefined.
%% Erlang type allowed to be used in SQLite bindings.

Expand Down Expand Up @@ -223,7 +217,7 @@ nif_stub_error(Line) ->
%% Backup options
%%
%% <ul>
%% <li>`from': source database name, `main' is the default</li>
%% <li>`from': source database name, `<<"main">>' is the default</li>
%% <li>`to': destination database name, takes `from' value as the default</li>
%% <li>`stop': backup step, pages. Default is 64</li>
%% <li>`progress': progress callback to invoke after finishing the next step</li>
Expand Down Expand Up @@ -426,7 +420,11 @@ finish(Prepared) ->
end.

%% @doc Returns column names and types for the prepared statement.
-spec describe(prepared_statement()) -> [{column_name(), column_type()}].
%%
%% SQLite uses dynamic type system. Types returned are column types specified
%% in the `CREATE TABLE' statement. SQLite accepts any string as a type name,
%% unless `STRICT' mode is used.
-spec describe(prepared_statement()) -> [{Name :: binary(), Type :: binary()}].
describe(Prepared) ->
case sqlite_describe_nif(Prepared) of
{error, Reason, ExtErr} ->
Expand Down Expand Up @@ -490,9 +488,10 @@ monitor(Connection) ->
Ref
end.

%% @doc Stops monitoring previously monitored connection.
%% @doc EXPERIMENTAL: Stops monitoring previously monitored connection.
%%
%% Does not flush messages that are already in transit.
%% This API is experimental and may change in the future.
-spec demonitor(reference()) -> ok.
demonitor(Ref) ->
case sqlite_monitor_nif(Ref, undefined) of
Expand Down Expand Up @@ -524,6 +523,7 @@ get_last_insert_rowid(Connection) ->
sqlite_get_last_insert_rowid_nif(Connection).

%% @doc Backs up the main database of the source to the destination.
-spec backup(Source :: connection(), Destination :: connection()) -> ok.
backup(Source, Destination) ->
backup(Source, Destination, #{from => <<"main">>, to => <<"main">>}).

Expand Down
12 changes: 6 additions & 6 deletions test/sqlite_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,12 @@ backup_sanity() ->
[{doc, ""}].

backup_sanity(Config) when is_list(Config) ->
%{Src0, Dst0, Backup0} = start_backup(),
%sqlite:close(Src0), %% must force-close the backup (causing backup to abort)
%{exception, error, badarg, [{sqlite, _, _, Ext} | _]} = continue_backup(Backup0),
%?assertEqual(#{1 => <<"backup aborted (connection closed)">>},
% maps:get(cause, proplists:get_value(error_info, Ext))),
%sqlite:close(Dst0),
{Src0, Dst0, Backup0} = start_backup(),
sqlite:close(Src0), %% must force-close the backup (causing backup to abort)
{exception, error, badarg, [{sqlite, _, _, Ext} | _]} = continue_backup(Backup0),
?assertEqual(#{1 => <<"backup aborted (connection closed)">>},
maps:get(cause, proplists:get_value(error_info, Ext))),
sqlite:close(Dst0),
{Src1, Dst1, Backup1} = start_backup(),
%% ensure that destination is locked when backup is in progress
?assertExtended(error, badarg, #{cause => #{1 => <<"connection busy (backup destination)">>}},
Expand Down

0 comments on commit 4bbc1f9

Please sign in to comment.