Skip to content

Commit

Permalink
fix: set parameter length (rows) correctly (#85)
Browse files Browse the repository at this point in the history
* set parameter length (rows) correctly

* test bulk-queries
  • Loading branch information
cocoa-xu authored May 22, 2024
1 parent af19e47 commit bdd25d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions c_src/adbc_column.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@ int adbc_column_to_arrow_type_struct(ErlNifEnv *env, ERL_NIF_TERM values, struct
}
} else if (enif_is_map(env, head)) {
int ret = adbc_column_to_adbc_field(env, head, child_i, schema_i, error_out);
array_out->length = child_i->length;
switch (ret)
{
case kErrorBufferIsNotAMap:
Expand Down
27 changes: 27 additions & 0 deletions test/adbc_sqlite_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,31 @@ defmodule Adbc.SQLite.Test do
assert abs(r1 - 1.1) < 1.0e-6
assert abs(r3 - 3.3) < 1.0e-6
end

test "bulk-queries", %{db: _, conn: conn} do
assert {:ok,
%Adbc.Result{
data: [
%Adbc.Column{
data: [1, 2],
metadata: nil,
name: "I64",
nullable: true,
type: :i64
},
%Adbc.Column{
name: "F64",
type: :f64,
nullable: true,
metadata: nil,
data: [3.3, 4.4]
}
],
num_rows: nil
}} ==
Connection.query(conn, "SELECT ? AS I64, ? AS F64", [
Adbc.Column.i64([1, 2]),
Adbc.Column.f64([3.3, 4.4])
])
end
end

0 comments on commit bdd25d2

Please sign in to comment.