get column types

This commit is contained in:
Michael Ries
2015-01-30 09:16:35 -07:00
parent 9967ced039
commit 19080b849c
5 changed files with 114 additions and 7 deletions

View File

@@ -32,6 +32,7 @@
fetchone/1,
fetchall/1,
column_names/1, column_names/2,
column_types/1, column_types/2,
close/1, close/2]).
-export([q/2, q/3, map/3, foreach/3]).
@@ -305,6 +306,18 @@ column_names(Stmt, Timeout) ->
ok = esqlite3_nif:column_names(Stmt, Ref, self()),
receive_answer(Ref, Timeout).
%% @doc Return the column types of the prepared statement.
%%
-spec column_types(statement()) -> tuple(atom()).
column_types(Stmt) ->
column_types(Stmt, ?DEFAULT_TIMEOUT).
-spec column_types(statement(), timeout()) -> tuple(atom()).
column_types(Stmt, Timeout) ->
Ref = make_ref(),
ok = esqlite3_nif:column_types(Stmt, Ref, self()),
receive_answer(Ref, Timeout).
%% @doc Close the database
%%
%% @spec close(connection()) -> ok | {error, error_message()}