fixes column types error
This commit is contained in:
@@ -587,8 +587,7 @@ do_column_types(ErlNifEnv *env, sqlite3_stmt *stmt)
|
|||||||
for(i = 0; i < size; i++) {
|
for(i = 0; i < size; i++) {
|
||||||
type = sqlite3_column_decltype(stmt, i);
|
type = sqlite3_column_decltype(stmt, i);
|
||||||
if(type == NULL) {
|
if(type == NULL) {
|
||||||
free(array);
|
type = "nil";
|
||||||
return make_error_tuple(env, "sqlite3_malloc_failure");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
array[i] = make_atom(env, type);
|
array[i] = make_atom(env, type);
|
||||||
|
|||||||
@@ -200,6 +200,16 @@ column_types_test() ->
|
|||||||
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
nil_column_types_test() ->
|
||||||
|
{ok, Db} = esqlite3:open(":memory:"),
|
||||||
|
ok = esqlite3:exec("begin;", Db),
|
||||||
|
ok = esqlite3:exec("create table t1(c1 variant);", Db),
|
||||||
|
ok = esqlite3:exec("commit;", Db),
|
||||||
|
|
||||||
|
{ok, Stmt} = esqlite3:prepare("select c1 + 1, c1 from t1", Db),
|
||||||
|
{nil, variant} = esqlite3:column_types(Stmt),
|
||||||
|
ok.
|
||||||
|
|
||||||
reset_test() ->
|
reset_test() ->
|
||||||
{ok, Db} = esqlite3:open(":memory:"),
|
{ok, Db} = esqlite3:open(":memory:"),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user