duckdb 1.1.0.1 β 1.1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test_on_macos.yml +8 -8
- data/.github/workflows/test_on_ubuntu.yml +2 -2
- data/.github/workflows/test_on_windows.yml +1 -1
- data/.gitignore +1 -0
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTION.md +1 -1
- data/Dockerfile +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/ext/duckdb/connection.c +0 -8
- data/ext/duckdb/extconf.rb +7 -3
- data/ext/duckdb/prepared_statement.c +24 -2
- data/ext/duckdb/result.c +7 -0
- data/ext/duckdb/ruby-duckdb.h +4 -4
- data/lib/duckdb/connection.rb +6 -0
- data/lib/duckdb/converter/int_to_sym.rb +39 -77
- data/lib/duckdb/converter.rb +2 -2
- data/lib/duckdb/result.rb +13 -5
- data/lib/duckdb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b6ad88562489a943d5ed0a4fcf56c4f84c9c3aa1a9f28d6d1fc6431c3fcea0b
|
4
|
+
data.tar.gz: ac3047cf0098642db942d3547d1e8069fdb53ac0c8eb7f757a0f15c31465b895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5614558f8685681f3369dfb4d8e36ead416b7ba1e4b0de48ff5edcc375a99c43bc1c3d996eca1f083d2df0352ced146f1e6d23bff99fa193035c9f996674e63d
|
7
|
+
data.tar.gz: 2ace009816b0dfee961d8db1b0864e512239186ebf7b8b0ffe20a360e0a247a68afd11c4b97993e350f7b2a7f8eb29d4b4b3fcb367b31c575a6163d1d9d333c6
|
@@ -15,8 +15,8 @@ jobs:
|
|
15
15
|
runs-on: macos-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby: ['3.1.6', '3.2.5', '3.3.5', '3.4.0-
|
19
|
-
duckdb: ['1.1.
|
18
|
+
ruby: ['3.1.6', '3.2.5', '3.3.5', '3.4.0-preview2', 'head']
|
19
|
+
duckdb: ['1.1.2', '1.1.1', '1.0.0']
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- uses: actions/checkout@v4
|
@@ -51,12 +51,12 @@ jobs:
|
|
51
51
|
run: |
|
52
52
|
bundle install --jobs 4 --retry 3
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
- name: Build test with DUCKDB_API_NO_DEPRECATED and Ruby ${{ matrix.ruby }}
|
55
|
+
env:
|
56
|
+
DUCKDB_VERSION: ${{ matrix.duckdb }}
|
57
|
+
run: |
|
58
|
+
env DUCKDB_API_NO_DEPRECATED=1 bundle exec rake build -- --with-duckdb-include=${GITHUB_WORKSPACE}/duckdb-v${DUCKDB_VERSION}/src/include --with-duckdb-lib=${GITHUB_WORKSPACE}/duckdb-v${DUCKDB_VERSION}/build/release/src/
|
59
|
+
bundle exec rake clean
|
60
60
|
|
61
61
|
- name: Build with Ruby ${{ matrix.ruby }}
|
62
62
|
env:
|
@@ -15,8 +15,8 @@ jobs:
|
|
15
15
|
runs-on: ubuntu-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby: ['3.1.6', '3.2.5', '3.3.5', '3.4.0-
|
19
|
-
duckdb: ['1.1.
|
18
|
+
ruby: ['3.1.6', '3.2.5', '3.3.5', '3.4.0-preview2', 'head']
|
19
|
+
duckdb: ['1.1.2', '1.1.1', '1.0.0']
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- uses: actions/checkout@v4
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
# Unreleased
|
5
5
|
|
6
|
+
# 1.1.2.0 - 2024-10-20
|
7
|
+
- bump duckdb to 1.1.2.
|
8
|
+
- add `DuckDB::PreparedStatement#destroy`.
|
9
|
+
- `DuckDB::Connection#query`, `DuckDB::Connection#async_query`, `DuckDB::Connection#async_query_stream` call
|
10
|
+
`DuckDB::PreparedStatement#destroy` to free the prepared statement immediately (#775, #781).
|
11
|
+
|
12
|
+
# 1.1.1.0 - 2024-10-06
|
13
|
+
- bump duckdb to 1.1.1.
|
14
|
+
## Breaking changes
|
15
|
+
- drop duckdb v0.10.x.
|
16
|
+
|
6
17
|
# 1.1.0.1 - 2024-09-21
|
7
18
|
- add `DuckDB::Connection#prepare`. `DuckDB::Connection#prepare` is an alias of `DuckDB::Connection#prepared_statement`.
|
8
19
|
|
data/CONTRIBUTION.md
CHANGED
@@ -14,7 +14,7 @@ docker compose run --rm ubuntu bash
|
|
14
14
|
|
15
15
|
In case you want custom ruby or duckdb versions, use `--build-arg` options
|
16
16
|
```
|
17
|
-
docker
|
17
|
+
docker compose build ubuntu --build-arg RUBY_VERSION=3.1.3 --build-arg DUCKDB_VERSION=1.0.0
|
18
18
|
```
|
19
19
|
|
20
20
|
### Without docker
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
duckdb (1.1.0
|
4
|
+
duckdb (1.1.2.0)
|
5
5
|
bigdecimal (>= 3.1.4)
|
6
6
|
|
7
7
|
GEM
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
racc (~> 1.4)
|
19
19
|
racc (1.8.1)
|
20
20
|
rake (13.2.1)
|
21
|
-
rake-compiler (1.2.
|
21
|
+
rake-compiler (1.2.8)
|
22
22
|
rake
|
23
23
|
ruby_memcheck (3.0.0)
|
24
24
|
nokogiri
|
data/ext/duckdb/connection.c
CHANGED
@@ -106,20 +106,12 @@ static VALUE duckdb_connection_interrupt(VALUE self) {
|
|
106
106
|
*/
|
107
107
|
static VALUE duckdb_connection_query_progress(VALUE self) {
|
108
108
|
rubyDuckDBConnection *ctx;
|
109
|
-
#ifdef HAVE_DUCKDB_H_GE_V0_10_0
|
110
109
|
duckdb_query_progress_type progress;
|
111
|
-
#else
|
112
|
-
double progress;
|
113
|
-
#endif
|
114
110
|
|
115
111
|
TypedData_Get_Struct(self, rubyDuckDBConnection, &connection_data_type, ctx);
|
116
112
|
progress = duckdb_query_progress(ctx->con);
|
117
113
|
|
118
|
-
#ifdef HAVE_DUCKDB_H_GE_V0_10_0
|
119
114
|
return rb_funcall(mDuckDBConverter, rb_intern("_to_query_progress"), 3, DBL2NUM(progress.percentage), ULL2NUM(progress.rows_processed), ULL2NUM(progress.total_rows_to_process));
|
120
|
-
#else
|
121
|
-
return DBL2NUM(progress);
|
122
|
-
#endif
|
123
115
|
}
|
124
116
|
|
125
117
|
static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase) {
|
data/ext/duckdb/extconf.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'mkmf'
|
4
4
|
|
5
|
-
DUCKDB_REQUIRED_VERSION = '0.
|
5
|
+
DUCKDB_REQUIRED_VERSION = '1.0.0'
|
6
6
|
|
7
7
|
def check_duckdb_header(header, version)
|
8
8
|
found = find_header(
|
@@ -58,8 +58,8 @@ dir_config('duckdb')
|
|
58
58
|
check_duckdb_header('duckdb.h', DUCKDB_REQUIRED_VERSION)
|
59
59
|
check_duckdb_library('duckdb', 'duckdb_appender_column_count', DUCKDB_REQUIRED_VERSION)
|
60
60
|
|
61
|
-
# check duckdb >= 0.
|
62
|
-
have_func('
|
61
|
+
# check duckdb >= 1.0.0
|
62
|
+
have_func('duckdb_fetch_chunk', 'duckdb.h')
|
63
63
|
|
64
64
|
# check duckdb >= 1.0.0
|
65
65
|
have_func('duckdb_fetch_chunk', 'duckdb.h')
|
@@ -67,6 +67,10 @@ have_func('duckdb_fetch_chunk', 'duckdb.h')
|
|
67
67
|
# check duckdb >= 1.1.0
|
68
68
|
have_func('duckdb_result_error_type', 'duckdb.h')
|
69
69
|
|
70
|
+
# Building with enabled DUCKDB_API_NO_DEPRECATED is failed with DuckDB v1.1.0 only.
|
71
|
+
# DuckDB v1.1.1 is fixed this issue https://github.com/duckdb/duckdb/issues/13872.
|
72
|
+
have_const('DUCKDB_TYPE_SQLNULL', 'duckdb.h')
|
73
|
+
|
70
74
|
$CFLAGS << ' -DDUCKDB_API_NO_DEPRECATED' if ENV['DUCKDB_API_NO_DEPRECATED']
|
71
75
|
|
72
76
|
create_makefile('duckdb/duckdb_native')
|
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
VALUE cDuckDBPreparedStatement;
|
4
4
|
|
5
|
+
static void destroy_prepared_statement(rubyDuckDBPreparedStatement *p);
|
5
6
|
static void deallocate(void *ctx);
|
6
7
|
static VALUE allocate(VALUE klass);
|
7
8
|
static size_t memsize(const void *p);
|
8
9
|
static VALUE duckdb_prepared_statement_initialize(VALUE self, VALUE con, VALUE query);
|
9
10
|
static VALUE duckdb_prepared_statement_nparams(VALUE self);
|
10
11
|
static VALUE duckdb_prepared_statement_execute(VALUE self);
|
12
|
+
static VALUE duckdb_prepared_statement_destroy(VALUE self);
|
11
13
|
static idx_t check_index(VALUE vidx);
|
12
14
|
|
13
15
|
static VALUE duckdb_prepared_statement_bind_parameter_index(VALUE self, VALUE name);
|
@@ -37,10 +39,17 @@ static const rb_data_type_t prepared_statement_data_type = {
|
|
37
39
|
0, 0, RUBY_TYPED_FREE_IMMEDIATELY
|
38
40
|
};
|
39
41
|
|
42
|
+
static void destroy_prepared_statement(rubyDuckDBPreparedStatement *p) {
|
43
|
+
if (p->prepared_statement) {
|
44
|
+
duckdb_destroy_prepare(&(p->prepared_statement));
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
40
48
|
static void deallocate(void *ctx) {
|
41
49
|
rubyDuckDBPreparedStatement *p = (rubyDuckDBPreparedStatement *)ctx;
|
42
50
|
|
43
|
-
|
51
|
+
destroy_prepared_statement(p);
|
52
|
+
// duckdb_destroy_prepare(&(p->prepared_statement));
|
44
53
|
xfree(p);
|
45
54
|
}
|
46
55
|
|
@@ -91,7 +100,6 @@ static VALUE duckdb_prepared_statement_nparams(VALUE self) {
|
|
91
100
|
return ULL2NUM(duckdb_nparams(ctx->prepared_statement));
|
92
101
|
}
|
93
102
|
|
94
|
-
|
95
103
|
static VALUE duckdb_prepared_statement_execute(VALUE self) {
|
96
104
|
rubyDuckDBPreparedStatement *ctx;
|
97
105
|
rubyDuckDBResult *ctxr;
|
@@ -105,6 +113,19 @@ static VALUE duckdb_prepared_statement_execute(VALUE self) {
|
|
105
113
|
return result;
|
106
114
|
}
|
107
115
|
|
116
|
+
/*
|
117
|
+
* :nodoc:
|
118
|
+
*/
|
119
|
+
static VALUE duckdb_prepared_statement_destroy(VALUE self) {
|
120
|
+
rubyDuckDBPreparedStatement *ctx;
|
121
|
+
TypedData_Get_Struct(self, rubyDuckDBPreparedStatement, &prepared_statement_data_type, ctx);
|
122
|
+
destroy_prepared_statement(ctx);
|
123
|
+
/*
|
124
|
+
ctx->prepared_statement = NULL;
|
125
|
+
*/
|
126
|
+
return Qnil;
|
127
|
+
}
|
128
|
+
|
108
129
|
static idx_t check_index(VALUE vidx) {
|
109
130
|
idx_t idx = NUM2ULL(vidx);
|
110
131
|
if (idx <= 0) {
|
@@ -391,6 +412,7 @@ void rbduckdb_init_duckdb_prepared_statement(void) {
|
|
391
412
|
|
392
413
|
rb_define_method(cDuckDBPreparedStatement, "initialize", duckdb_prepared_statement_initialize, 2);
|
393
414
|
rb_define_method(cDuckDBPreparedStatement, "execute", duckdb_prepared_statement_execute, 0);
|
415
|
+
rb_define_method(cDuckDBPreparedStatement, "destroy", duckdb_prepared_statement_destroy, 0);
|
394
416
|
rb_define_method(cDuckDBPreparedStatement, "nparams", duckdb_prepared_statement_nparams, 0);
|
395
417
|
rb_define_method(cDuckDBPreparedStatement, "bind_parameter_index", duckdb_prepared_statement_bind_parameter_index, 1);
|
396
418
|
rb_define_method(cDuckDBPreparedStatement, "parameter_name", duckdb_prepared_statement_parameter_name, 1);
|
data/ext/duckdb/result.c
CHANGED
@@ -310,7 +310,14 @@ static VALUE duckdb_result__column_type(VALUE oDuckDBResult, VALUE col_idx) {
|
|
310
310
|
static VALUE duckdb_result__return_type(VALUE oDuckDBResult) {
|
311
311
|
rubyDuckDBResult *ctx;
|
312
312
|
TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
|
313
|
+
/*
|
314
|
+
* remove this #if ... #else statement when dropping duckdb 1.1.0.
|
315
|
+
*/
|
316
|
+
#if !defined(HAVE_DUCKDB_H_GE_V1_1_1) && defined(HAVE_DUCKDB_H_GE_V1_1_0) && defined(DUCKDB_API_NO_DEPRECATED)
|
317
|
+
rb_raise(eDuckDBError, "duckdb_result_return_type C-API is not available with duckdb v1.1.0 with enabled DUCKDB_API_NO_DEPRECATED.");
|
318
|
+
#else
|
313
319
|
return INT2FIX(duckdb_result_return_type(ctx->result));
|
320
|
+
#endif
|
314
321
|
}
|
315
322
|
|
316
323
|
static VALUE duckdb_result__statement_type(VALUE oDuckDBResult) {
|
data/ext/duckdb/ruby-duckdb.h
CHANGED
@@ -7,10 +7,6 @@
|
|
7
7
|
#include "ruby.h"
|
8
8
|
#include <duckdb.h>
|
9
9
|
|
10
|
-
#ifdef HAVE_DUCKDB_APPENDER_COLUMN_COUNT
|
11
|
-
#define HAVE_DUCKDB_H_GE_V0_10_0 1
|
12
|
-
#endif
|
13
|
-
|
14
10
|
#ifdef HAVE_DUCKDB_FETCH_CHUNK
|
15
11
|
#define HAVE_DUCKDB_H_GE_V1_0_0 1
|
16
12
|
#endif
|
@@ -19,6 +15,10 @@
|
|
19
15
|
#define HAVE_DUCKDB_H_GE_V1_1_0 1
|
20
16
|
#endif
|
21
17
|
|
18
|
+
#ifdef HAVE_CONST_DUCKDB_TYPE_SQLNULL
|
19
|
+
#define HAVE_DUCKDB_H_GE_V1_1_1 1
|
20
|
+
#endif
|
21
|
+
|
22
22
|
#include "./error.h"
|
23
23
|
#include "./database.h"
|
24
24
|
#include "./connection.h"
|
data/lib/duckdb/connection.rb
CHANGED
@@ -31,6 +31,8 @@ module DuckDB
|
|
31
31
|
stmt = PreparedStatement.new(self, sql)
|
32
32
|
stmt.bind_args(*args, **kwargs)
|
33
33
|
stmt.execute
|
34
|
+
ensure
|
35
|
+
stmt&.destroy
|
34
36
|
end
|
35
37
|
|
36
38
|
#
|
@@ -53,6 +55,8 @@ module DuckDB
|
|
53
55
|
stmt = PreparedStatement.new(self, sql)
|
54
56
|
stmt.bind_args(*args, **kwargs)
|
55
57
|
stmt.pending_prepared
|
58
|
+
ensure
|
59
|
+
stmt&.destroy
|
56
60
|
end
|
57
61
|
|
58
62
|
#
|
@@ -76,6 +80,8 @@ module DuckDB
|
|
76
80
|
stmt = PreparedStatement.new(self, sql)
|
77
81
|
stmt.bind_args(*args, **kwargs)
|
78
82
|
stmt.pending_prepared_stream
|
83
|
+
ensure
|
84
|
+
stmt&.destroy
|
79
85
|
end
|
80
86
|
|
81
87
|
#
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DuckDB
|
4
4
|
module Converter
|
5
|
-
module IntToSym
|
5
|
+
module IntToSym # :nodoc: all
|
6
6
|
STATEMENT_TYPES = %i[
|
7
7
|
invalid
|
8
8
|
select
|
@@ -34,90 +34,52 @@ module DuckDB
|
|
34
34
|
multi
|
35
35
|
].freeze
|
36
36
|
|
37
|
-
HASH_TYPES =
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
else
|
74
|
-
{
|
75
|
-
0 => :invalid,
|
76
|
-
1 => :boolean,
|
77
|
-
2 => :tinyint,
|
78
|
-
3 => :smallint,
|
79
|
-
4 => :integer,
|
80
|
-
5 => :bigint,
|
81
|
-
6 => :utinyint,
|
82
|
-
7 => :usmallint,
|
83
|
-
8 => :uinteger,
|
84
|
-
9 => :ubigint,
|
85
|
-
10 => :float,
|
86
|
-
11 => :double,
|
87
|
-
12 => :timestamp,
|
88
|
-
13 => :date,
|
89
|
-
14 => :time,
|
90
|
-
15 => :interval,
|
91
|
-
16 => :hugeint,
|
92
|
-
32 => :uhugeint,
|
93
|
-
17 => :varchar,
|
94
|
-
18 => :blob,
|
95
|
-
19 => :decimal,
|
96
|
-
20 => :timestamp_s,
|
97
|
-
21 => :timestamp_ms,
|
98
|
-
22 => :timestamp_ns,
|
99
|
-
23 => :enum,
|
100
|
-
24 => :list,
|
101
|
-
25 => :struct,
|
102
|
-
26 => :map,
|
103
|
-
33 => :array,
|
104
|
-
27 => :uuid,
|
105
|
-
28 => :union,
|
106
|
-
29 => :bit,
|
107
|
-
30 => :time_tz,
|
108
|
-
31 => :timestamp_tz
|
109
|
-
}.freeze
|
110
|
-
end
|
37
|
+
HASH_TYPES = {
|
38
|
+
0 => :invalid,
|
39
|
+
1 => :boolean,
|
40
|
+
2 => :tinyint,
|
41
|
+
3 => :smallint,
|
42
|
+
4 => :integer,
|
43
|
+
5 => :bigint,
|
44
|
+
6 => :utinyint,
|
45
|
+
7 => :usmallint,
|
46
|
+
8 => :uinteger,
|
47
|
+
9 => :ubigint,
|
48
|
+
10 => :float,
|
49
|
+
11 => :double,
|
50
|
+
12 => :timestamp,
|
51
|
+
13 => :date,
|
52
|
+
14 => :time,
|
53
|
+
15 => :interval,
|
54
|
+
16 => :hugeint,
|
55
|
+
32 => :uhugeint,
|
56
|
+
17 => :varchar,
|
57
|
+
18 => :blob,
|
58
|
+
19 => :decimal,
|
59
|
+
20 => :timestamp_s,
|
60
|
+
21 => :timestamp_ms,
|
61
|
+
22 => :timestamp_ns,
|
62
|
+
23 => :enum,
|
63
|
+
24 => :list,
|
64
|
+
25 => :struct,
|
65
|
+
26 => :map,
|
66
|
+
33 => :array,
|
67
|
+
27 => :uuid,
|
68
|
+
28 => :union,
|
69
|
+
29 => :bit,
|
70
|
+
30 => :time_tz,
|
71
|
+
31 => :timestamp_tz
|
72
|
+
}.freeze
|
111
73
|
|
112
74
|
module_function
|
113
75
|
|
114
|
-
def statement_type_to_sym(val)
|
76
|
+
def statement_type_to_sym(val) # :nodoc:
|
115
77
|
raise DuckDB::Error, "Unknown statement type: #{val}" if val >= STATEMENT_TYPES.size
|
116
78
|
|
117
79
|
STATEMENT_TYPES[val]
|
118
80
|
end
|
119
81
|
|
120
|
-
def type_to_sym(val)
|
82
|
+
def type_to_sym(val) # :nodoc:
|
121
83
|
raise DuckDB::Error, "Unknown type: #{val}" unless HASH_TYPES.key?(val)
|
122
84
|
|
123
85
|
HASH_TYPES[val]
|
data/lib/duckdb/converter.rb
CHANGED
@@ -7,7 +7,7 @@ require_relative 'converter/int_to_sym'
|
|
7
7
|
module DuckDB
|
8
8
|
QueryProgress = Struct.new(:percentage, :rows_processed, :total_rows_to_process)
|
9
9
|
|
10
|
-
module Converter
|
10
|
+
module Converter # :nodoc: all
|
11
11
|
HALF_HUGEINT_BIT = 64
|
12
12
|
HALF_HUGEINT = 1 << HALF_HUGEINT_BIT
|
13
13
|
FLIP_HUGEINT = 1 << 63
|
@@ -122,7 +122,7 @@ module DuckDB
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def _to_uuid_from_vector(lower, upper)
|
125
|
-
upper
|
125
|
+
upper ^= FLIP_HUGEINT
|
126
126
|
upper += HALF_HUGEINT if upper.negative?
|
127
127
|
|
128
128
|
str = _to_hugeint_from_vector(lower, upper).to_s(16).rjust(32, '0')
|
data/lib/duckdb/result.rb
CHANGED
@@ -34,7 +34,7 @@ module DuckDB
|
|
34
34
|
raise DuckDB::Error, 'DuckDB::Result cannot be instantiated directly.'
|
35
35
|
end
|
36
36
|
|
37
|
-
def use_chunk_each=(value)
|
37
|
+
def use_chunk_each=(value) # :nodoc:
|
38
38
|
raise('`changing DuckDB::Result.use_chunk_each to false` was deprecated.') unless value
|
39
39
|
|
40
40
|
warn('`DuckDB::Result.use_chunk_each=` will be deprecated.')
|
@@ -42,21 +42,21 @@ module DuckDB
|
|
42
42
|
true
|
43
43
|
end
|
44
44
|
|
45
|
-
def use_chunk_each?
|
45
|
+
def use_chunk_each? # :nodoc:
|
46
46
|
warn('`DuckDB::Result.use_chunk_each?` will be deprecated.')
|
47
47
|
true
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def each
|
51
|
+
def each(&)
|
52
52
|
if streaming?
|
53
53
|
return _chunk_stream unless block_given?
|
54
54
|
|
55
|
-
_chunk_stream
|
55
|
+
_chunk_stream(&)
|
56
56
|
else
|
57
57
|
return chunk_each unless block_given?
|
58
58
|
|
59
|
-
chunk_each
|
59
|
+
chunk_each(&)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -91,6 +91,14 @@ module DuckDB
|
|
91
91
|
Converter::IntToSym.statement_type_to_sym(i)
|
92
92
|
end
|
93
93
|
|
94
|
+
# returns all available ENUM type values of the specified column index.
|
95
|
+
# require 'duckdb'
|
96
|
+
# db = DuckDB::Database.open('duckdb_database')
|
97
|
+
# con = db.connect
|
98
|
+
# con.execute("CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', 'πΎπΎΦ
Ι π')")
|
99
|
+
# con.execute("CREATE TABLE enums (id INTEGER, mood mood)")
|
100
|
+
# result = con.query('SELECT * FROM enums')
|
101
|
+
# result.enum_dictionary_values(1) # => ['sad', 'ok', 'happy', 'πΎπΎΦ
Ι π']
|
94
102
|
def enum_dictionary_values(col_index)
|
95
103
|
values = []
|
96
104
|
_enum_dictionary_size(col_index).times do |i|
|
data/lib/duckdb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duckdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaki Suketa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|