Skip to content

Commit 2eacc62

Browse files
committed
DuckDB 1.2.0
1 parent 298ff5a commit 2eacc62

15 files changed

+360947
-317655
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
0.3.9
4+
- [DuckDB 1.2.0 release](https://github.com/duckdb/duckdb/releases/tag/v1.2.0). Please, read the [Announcing DuckDB 1.2.0](https://duckdb.org/2025/02/05/announcing-duckdb-120)
5+
- Fixed the isinf/isnan build error on Linux
6+
- `DuckDB.query(sql)` without parameters can execute multiple SQL statements at onсe.
7+
38
0.3.8
49
- Added transaction managing functions: begin_transaction, commit, rollback, set_auto_commit, is_auto_commit, has_active_transaction
510

README.md

+26-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ The library uses `amalgamation` of the DuckDB sources, which combine all sources
1212

1313
All NIF functions implemented as [**Dirty NIF**](https://www.erlang.org/doc/man/erl_nif.html)
1414

15-
**DuckDB is in the active development phase, and new version of library may not open the database created by the old version.**
16-
17-
[HexDocs](https://hexdocs.pm/duckdbex/)
15+
Online [HexDocs](https://hexdocs.pm/duckdbex/)
1816

1917
## Installation
2018

@@ -24,7 +22,7 @@ by adding `duckdbex` to your list of dependencies in `mix.exs`:
2422
```elixir
2523
def deps do
2624
[
27-
{:duckdbex, "~> 0.3.0"}
25+
{:duckdbex, "~> 0.3.9"}
2826
]
2927
end
3028
```
@@ -401,3 +399,27 @@ conf = %Duckdbex.Config{allow_unsigned_extensions: true}
401399
```
402400

403401
Documentation generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
402+
403+
## Huge numbers (hugeint)
404+
405+
The BIGINT and HUGEINT types are designed to be used when the range of the integer type is insufficient. Hugeint in DuckDB is 128bit integer. Because max native integer in C++ is 64bit integer, HUGEINT is represented as combination of two 64bit integers. There is no efficient way to pass HUGEINT from DuckDB(C++) to Elixir(Erlang) than to pass it as is - combination of two 64bit integers. But in Elixir there is no restrictions to integers, so if you will get instead of integer a tuple of two integers you should conver it to integet via `DuckDB.hugeint_to_integer({upper_int, lower_int})`.
406+
407+
```elixir
408+
> {:ok, r} = Duckdbex.query(conn, "SELECT SUM(1);")
409+
> Duckdbex.fetch_all(r)
410+
[[{0, 1}]]
411+
> Duckdbex.hugeint_to_integer({0, 1})
412+
1
413+
```
414+
415+
And vice versa, if you should pass HUGEINT as argument to sql query, you should convert this argument to 'native' representation
416+
417+
```elixir
418+
> hi = Duckdbex.integer_to_hugeint(123456789123456789123456789)
419+
{6692605, 17502027875430457109}
420+
> {:ok, r} = Duckdbex.query(conn, "SELECT SUM(1234567891234567891234567891) > $1;", [hi])
421+
> Duckdbex.fetch_all(r)
422+
[[true]]
423+
```
424+
425+
Currently Duckdbex lib didn't convert automatically `hugeint_to_integer` for you because this is additional extra pass through your collection of rows which will be executed inside the library.

0 commit comments

Comments
 (0)