duckdb 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9967f34d6c3a9f9d30fc9c406043230d86ffe98d0ca5cf55e74a547f6877b756
4
- data.tar.gz: e28bce3d7b8410ceff6da630aaa54eab4d345bfab16748f9150dfef6e3836bfe
3
+ metadata.gz: d4780513bea94513e38b460cf9580b9bad9b9128d913a46f58f2054451cf838d
4
+ data.tar.gz: 5cbfe5da32da9562d121d634a7a45fdc153222bb4c5b8c79a2f37dbff6f57f27
5
5
  SHA512:
6
- metadata.gz: 834d11017be58ad60d8f8d8600e22f7e97dbac4ef2789921d2da8f76487e7df3c60a7458ece7e7d5f3fb7d1aca3bcf178557968131673055c2bf2d932bc982d6
7
- data.tar.gz: f63d824d611095b857310f6f2f1c432d0129be7bbc3d03cb339baf938bd00c43e7911689b988494e4613f4199abf72a1b08c022d7adac26cc29f2e13ecd49883
6
+ metadata.gz: 04acc6297bac9ae7d217072d1fec3b7c603f407270143d654f738462e0f540a2e8ebdb67fa4d466ff13636dab279a0d245241201c9b3f829f4e97fbf628fb086
7
+ data.tar.gz: aa200fce49d05edee27095771e4c7e394a7431b8b1881e58d053f46dafc628920e4924c899159619c2fd337c6607eeed55f5863ea0e119f13ec2236d72c33f6b
@@ -15,8 +15,8 @@ jobs:
15
15
  runs-on: macos-latest
16
16
  strategy:
17
17
  matrix:
18
- ruby: ['2.6.10', '2.7.7', '3.0.5', '3.1.3', '3.2.0', 'head']
19
- duckdb: ['0.5.1', '0.6.1']
18
+ ruby: ['2.7.7', '3.0.5', '3.1.3', '3.2.1', 'head']
19
+ duckdb: ['0.7.0', '0.6.1']
20
20
 
21
21
  steps:
22
22
  - uses: actions/checkout@v3
@@ -15,8 +15,8 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
17
  matrix:
18
- ruby: ['2.6.10', '2.7.7', '3.0.5', '3.1.3', '3.2.0', 'head']
19
- duckdb: ['0.5.1', '0.6.1']
18
+ ruby: ['2.7.7', '3.0.5', '3.1.3', '3.2.1', 'head']
19
+ duckdb: ['0.7.0', '0.6.1']
20
20
 
21
21
  steps:
22
22
  - uses: actions/checkout@v3
@@ -15,8 +15,8 @@ jobs:
15
15
  runs-on: windows-latest
16
16
  strategy:
17
17
  matrix:
18
- ruby: ['2.6.10', '2.7.6', '3.0.4', '3.1.2', 'ucrt', 'mingw', 'head']
19
- duckdb: ['0.5.1', '0.6.1']
18
+ ruby: ['2.7.7', '3.0.5', '3.1.3', '3.2.1', 'ucrt', 'mingw', 'mswin', 'head']
19
+ duckdb: ['0.7.0', '0.6.1']
20
20
 
21
21
  steps:
22
22
  - uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # ChangeLog
2
2
 
3
+ # 0.7.0
4
+ - bump duckdb to 0.7.0
5
+ - fix have_func argument order
6
+ - remove unused variable in test
7
+ - add DuckDB::LIBRARY_VERSION
8
+ - add DuckDB::Result#_to_string_internal
9
+ - add DuckDB::Result#__to_hugeint_internal
10
+ - add DuckDB::Result#__to_decimal_internal
11
+ - add Ruby 3.2.1 on CI test
12
+ - add Ruby mswin on CI test
13
+ ## Breaking Change
14
+ - drop Ruby 2.6
15
+
3
16
  # 0.6.1
4
17
  - bump Ruby to 3.2.0 on CI
5
18
  - fix deprected warning (double_heap is deprecated in GC.verify_compaction_references) with Ruby 3.2.0 on CI
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- duckdb (0.6.1)
4
+ duckdb (0.7.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- minitest (5.16.3)
9
+ minitest (5.17.0)
10
10
  rake (13.0.6)
11
- rake-compiler (1.2.0)
11
+ rake-compiler (1.2.1)
12
12
  rake
13
13
 
14
14
  PLATFORMS
data/duckdb.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  end
27
27
  spec.require_paths = ['lib']
28
28
  spec.extensions = ['ext/duckdb/extconf.rb']
29
- spec.required_ruby_version = '>= 2.6.0'
29
+ spec.required_ruby_version = '>= 2.7.0'
30
30
 
31
31
  spec.add_development_dependency 'bundler', '~> 2.3'
32
32
  spec.add_development_dependency 'minitest', '~> 5.0'
@@ -2,7 +2,7 @@ require 'mkmf'
2
2
 
3
3
  def duckdb_library_available?(func)
4
4
  header = find_header('duckdb.h') || find_header('duckdb.h', '/opt/homebrew/include')
5
- library = have_func('duckdb', func) || find_library('duckdb', func, '/opt/homebrew/opt/duckdb/lib')
5
+ library = have_func(func, 'duckdb.h') || find_library('duckdb', func, '/opt/homebrew/opt/duckdb/lib')
6
6
  header && library
7
7
  end
8
8
 
data/ext/duckdb/result.c CHANGED
@@ -10,6 +10,8 @@ static VALUE to_ruby_obj_smallint(duckdb_result *result, idx_t col_idx, idx_t ro
10
10
  static VALUE to_ruby_obj_utinyint(duckdb_result *result, idx_t col_idx, idx_t row_idx);
11
11
  static VALUE to_ruby_obj_integer(duckdb_result *result, idx_t col_idx, idx_t row_idx);
12
12
  static VALUE to_ruby_obj_bigint(duckdb_result *result, idx_t col_idx, idx_t row_idx);
13
+ static VALUE to_ruby_obj_hugeint(duckdb_result *result, idx_t col_idx, idx_t row_idx);
14
+ static VALUE to_ruby_obj_decimal(duckdb_result *result, idx_t col_idx, idx_t row_idx);
13
15
  static VALUE to_ruby_obj_float(duckdb_result *result, idx_t col_idx, idx_t row_idx);
14
16
  static VALUE to_ruby_obj_double(duckdb_result *result, idx_t col_idx, idx_t row_idx);
15
17
  static VALUE to_ruby_obj_blob(duckdb_result *result, idx_t col_idx, idx_t row_idx);
@@ -24,9 +26,12 @@ static VALUE duckdb_result__to_smallint(VALUE oDuckDBResult, VALUE row_idx, VALU
24
26
  static VALUE duckdb_result__to_utinyint(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
25
27
  static VALUE duckdb_result__to_integer(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
26
28
  static VALUE duckdb_result__to_bigint(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
29
+ static VALUE duckdb_result___to_hugeint_internal(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
30
+ static VALUE duckdb_result___to_decimal_internal(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
27
31
  static VALUE duckdb_result__to_float(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
28
32
  static VALUE duckdb_result__to_double(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
29
33
  static VALUE duckdb_result__to_string(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
34
+ static VALUE duckdb_result__to_string_internal(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
30
35
  static VALUE duckdb_result__to_blob(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx);
31
36
  static VALUE duckdb_result__enum_internal_type(VALUE oDuckDBResult, VALUE col_idx);
32
37
  static VALUE duckdb_result__enum_dictionary_size(VALUE oDuckDBResult, VALUE col_idx);
@@ -85,6 +90,16 @@ static VALUE to_ruby_obj_bigint(duckdb_result *result, idx_t col_idx, idx_t row_
85
90
  return rb_int2big(i64val);
86
91
  }
87
92
 
93
+ static VALUE to_ruby_obj_hugeint(duckdb_result *result, idx_t col_idx, idx_t row_idx) {
94
+ duckdb_hugeint hugeint = duckdb_value_hugeint(result, col_idx, row_idx);
95
+ return rb_ary_new3(2, ULL2NUM(hugeint.lower), LL2NUM(hugeint.upper));
96
+ }
97
+
98
+ static VALUE to_ruby_obj_decimal(duckdb_result *result, idx_t col_idx, idx_t row_idx) {
99
+ duckdb_decimal decimal = duckdb_value_decimal(result, col_idx, row_idx);
100
+ return rb_ary_new3(4, ULL2NUM(decimal.value.lower), LL2NUM(decimal.value.upper), UINT2NUM(decimal.width), UINT2NUM(decimal.scale));
101
+ }
102
+
88
103
  static VALUE to_ruby_obj_float(duckdb_result *result, idx_t col_idx, idx_t row_idx) {
89
104
  float fval = duckdb_value_float(result, col_idx, row_idx);
90
105
  return DBL2NUM(fval);
@@ -255,6 +270,20 @@ static VALUE duckdb_result__to_bigint(VALUE oDuckDBResult, VALUE row_idx, VALUE
255
270
  return to_ruby_obj_bigint(&(ctx->result), NUM2LL(col_idx), NUM2LL(row_idx));
256
271
  }
257
272
 
273
+ static VALUE duckdb_result___to_hugeint_internal(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx) {
274
+ rubyDuckDBResult *ctx;
275
+ TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
276
+
277
+ return to_ruby_obj_hugeint(&(ctx->result), NUM2LL(col_idx), NUM2LL(row_idx));
278
+ }
279
+
280
+ static VALUE duckdb_result___to_decimal_internal(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx) {
281
+ rubyDuckDBResult *ctx;
282
+ TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
283
+
284
+ return to_ruby_obj_decimal(&(ctx->result), NUM2LL(col_idx), NUM2LL(row_idx));
285
+ }
286
+
258
287
  static VALUE duckdb_result__to_float(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx) {
259
288
  rubyDuckDBResult *ctx;
260
289
  TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
@@ -295,6 +324,30 @@ static VALUE duckdb_result__to_string(VALUE oDuckDBResult, VALUE row_idx, VALUE
295
324
  return Qnil;
296
325
  }
297
326
 
327
+ static VALUE duckdb_result__to_string_internal(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx) {
328
+ rubyDuckDBResult *ctx;
329
+ #ifdef HAVE_DUCKDB_H_GE_V060
330
+ duckdb_string p;
331
+ #else
332
+ char *p;
333
+ #endif
334
+ VALUE obj;
335
+ TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
336
+
337
+ #ifdef HAVE_DUCKDB_H_GE_V060
338
+ p = duckdb_value_string_internal(&(ctx->result), NUM2LL(col_idx), NUM2LL(row_idx));
339
+ if (p.data) {
340
+ obj = rb_utf8_str_new(p.data, p.size);
341
+ #else
342
+ p = duckdb_value_varchar_internal(&(ctx->result), NUM2LL(col_idx), NUM2LL(row_idx));
343
+ if (p) {
344
+ obj = rb_utf8_str_new_cstr(p);
345
+ #endif
346
+ return obj;
347
+ }
348
+ return Qnil;
349
+ }
350
+
298
351
  static VALUE duckdb_result__to_blob(VALUE oDuckDBResult, VALUE row_idx, VALUE col_idx) {
299
352
  rubyDuckDBResult *ctx;
300
353
  TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
@@ -365,9 +418,12 @@ void init_duckdb_result(void) {
365
418
  rb_define_private_method(cDuckDBResult, "_to_utinyint", duckdb_result__to_utinyint, 2);
366
419
  rb_define_private_method(cDuckDBResult, "_to_integer", duckdb_result__to_integer, 2);
367
420
  rb_define_private_method(cDuckDBResult, "_to_bigint", duckdb_result__to_bigint, 2);
421
+ rb_define_private_method(cDuckDBResult, "__to_hugeint_internal", duckdb_result___to_hugeint_internal, 2);
422
+ rb_define_private_method(cDuckDBResult, "__to_decimal_internal", duckdb_result___to_decimal_internal, 2);
368
423
  rb_define_private_method(cDuckDBResult, "_to_float", duckdb_result__to_float, 2);
369
424
  rb_define_private_method(cDuckDBResult, "_to_double", duckdb_result__to_double, 2);
370
425
  rb_define_private_method(cDuckDBResult, "_to_string", duckdb_result__to_string, 2);
426
+ rb_define_private_method(cDuckDBResult, "_to_string_internal", duckdb_result__to_string_internal, 2);
371
427
  rb_define_private_method(cDuckDBResult, "_to_blob", duckdb_result__to_blob, 2);
372
428
  rb_define_private_method(cDuckDBResult, "_enum_internal_type", duckdb_result__enum_internal_type, 1);
373
429
  rb_define_private_method(cDuckDBResult, "_enum_dictionary_size", duckdb_result__enum_dictionary_size, 1);
@@ -0,0 +1,3 @@
1
+ module DuckDB
2
+ LIBRARY_VERSION = library_version[1..] if defined? library_version
3
+ end
@@ -1,5 +1,5 @@
1
1
  module DuckDB
2
2
  # The version string of ruby-duckdb.
3
3
  # Currently, ruby-duckdb is NOT semantic versioning.
4
- VERSION = '0.6.1'.freeze
4
+ VERSION = '0.7.0'.freeze
5
5
  end
data/lib/duckdb.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'duckdb/duckdb_native'
2
+ require 'duckdb/library_version'
2
3
  require 'duckdb/version'
3
4
  require 'duckdb/converter'
4
5
  require 'duckdb/database'
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: 0.6.1
4
+ version: 0.7.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: 2022-12-30 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,6 +119,7 @@ files:
119
119
  - lib/duckdb/connection.rb
120
120
  - lib/duckdb/converter.rb
121
121
  - lib/duckdb/database.rb
122
+ - lib/duckdb/library_version.rb
122
123
  - lib/duckdb/prepared_statement.rb
123
124
  - lib/duckdb/result.rb
124
125
  - lib/duckdb/version.rb
@@ -137,14 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
138
  requirements:
138
139
  - - ">="
139
140
  - !ruby/object:Gem::Version
140
- version: 2.6.0
141
+ version: 2.7.0
141
142
  required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  requirements:
143
144
  - - ">="
144
145
  - !ruby/object:Gem::Version
145
146
  version: '0'
146
147
  requirements: []
147
- rubygems_version: 3.4.1
148
+ rubygems_version: 3.4.6
148
149
  signing_key:
149
150
  specification_version: 4
150
151
  summary: This module is Ruby binding for DuckDB database engine.