Merged interrupt after timeout pr (#71)

* Merged interrupt after timeout pr

* Bump version number
This commit is contained in:
Maas-Maarten Zeeman
2022-01-03 15:10:40 +01:00
committed by GitHub
parent 852c3286cf
commit f60a0b45e7
5 changed files with 69 additions and 19 deletions

View File

@@ -1219,6 +1219,24 @@ esqlite_column_types(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
return push_command(env, conn, cmd);
}
/*
* Interrupt currently active query.
*/
static ERL_NIF_TERM
esqlite_interrupt(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
esqlite_connection *conn;
if(!enif_get_resource(env, argv[0], esqlite_connection_type, (void **) &conn))
return enif_make_badarg(env);
esqlite_connection *db = (esqlite_connection *) conn;
sqlite3_interrupt(db->db);
return enif_make_atom(env, "ok");
}
/*
* Close the database
*/
@@ -1297,6 +1315,7 @@ static ErlNifFunc nif_funcs[] = {
{"bind", 5, esqlite_bind},
{"column_names", 4, esqlite_column_names},
{"column_types", 4, esqlite_column_types},
{"interrupt", 1, esqlite_interrupt, ERL_NIF_DIRTY_JOB_IO_BOUND},
{"close", 3, esqlite_close}
};