Turn on sqlite's extended error codes

This commit is contained in:
Maas-Maarten Zeeman
2022-05-19 08:21:38 +02:00
parent 616127c748
commit 77cea7e902
5 changed files with 121 additions and 148 deletions

View File

@@ -22,7 +22,8 @@
open/1, close/1,
prepare/2,
column_names/1
column_names/1,
column_decltypes/1
% set_update_hook/2, set_update_hook/3,
% exec/2, exec/3, exec/4,
@@ -448,21 +449,20 @@ prepare(#esqlite3{db=Connection}, Sql) ->
%
%% @doc Return the column names of the prepared statement.
%%
-spec column_names(esqlite3_stmt()) -> [binary()].
-spec column_names(Statement) -> Names
when Statement :: esqlite3_stmt(),
Names :: list(binary()).
column_names(#esqlite3_stmt{stmt=Stmt}) ->
esqlite3_nif:column_names(Stmt).
%% @doc Return the column types of the prepared statement.
%%
%-spec column_types(statement()) -> {atom()}.
%column_types(Statement) ->
% column_types(Statement, ?DEFAULT_TIMEOUT).
-spec column_decltypes(Statement) -> Types
when Statement :: esqlite3_stmt(),
Types :: list(binary() | undefined).
column_decltypes(#esqlite3_stmt{stmt=Stmt}) ->
esqlite3_nif:column_decltypes(Stmt).
%-spec column_types(statement(), timeout()) -> {atom()}.
%column_types(#statement{raw_statement=RawStatement, raw_connection=RawConnection}, Timeout) ->
% Ref = make_ref(),
% ok = esqlite3_nif:column_types(RawConnection, RawStatement, Ref, self()),
% receive_answer(RawConnection, Ref, Timeout).
%% @doc make multiple sqlite steps per call return rows in reverse order
%%

View File

@@ -25,6 +25,7 @@
prepare/2,
column_names/1,
column_decltypes/1,
interrupt/1
% set_update_hook/4,
@@ -141,15 +142,16 @@ prepare(_Connection, _Sql) ->
%% @doc Retrieve the column names of the prepared statement
%%
-spec column_names(esqlite3_stmt()) -> list() | {error, _}.
-spec column_names(esqlite3_stmt()) -> list(binary()) | {error, _}.
column_names(_Stmt) ->
erlang:nif_error(nif_library_not_loaded).
%% @doc Retrieve the column types of the prepared statement
%% @doc Retrieve the declared datatypes of all columns.
%%
%-spec column_types(esqlite3(), esqlite3_stmt(), reference(), pid()) -> ok | {error, _}.
%column_types(_Db, _Stmt, _Ref, _Dest) ->
% erlang:nif_error(nif_library_not_loaded).
-spec column_decltypes(esqlite3_stmt()) -> list(undefined | binary()) | {error, _}.
column_decltypes(_Stmt) ->
erlang:nif_error(nif_library_not_loaded).
%% @doc Initialize a backup procedure of a database.
%-spec backup_init(esqlite3(), string(), esqlite3_stmt(), string(), reference(), pid()) -> ok | {error, _}.