Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion c_src/sqlite3_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ exqlite_changes(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
return make_error_tuple(env, "invalid_connection");
}

if (conn->db == NULL) {
return make_error_tuple(env, "connection_closed");
}

int changes = sqlite3_changes(conn->db);
return make_ok_tuple(env, enif_make_int(env, changes));
}
Expand Down Expand Up @@ -386,7 +390,7 @@ exqlite_prepare(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
if (conn->db == NULL) {
enif_mutex_unlock(conn->mutex);
enif_release_resource(statement);
return make_error_tuple(env, "connection closed");
return make_error_tuple(env, "connection_closed");
}
rc = sqlite3_prepare_v3(conn->db, (char*)bin.data, bin.size, 0, &statement->statement, NULL);
enif_mutex_unlock(conn->mutex);
Expand Down