duckdb 1.1.2.1 → 1.1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test_on_macos.yml +2 -2
- data/.github/workflows/test_on_ubuntu.yml +2 -2
- data/.github/workflows/test_on_windows.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/Dockerfile +2 -2
- data/Gemfile.lock +1 -1
- data/ext/duckdb/extracted_statements.c +0 -1
- data/lib/duckdb/converter.rb +20 -0
- data/lib/duckdb/prepared_statement.rb +20 -1
- 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: 5d9c9c9844335a39c1c154534cb50c031f872679c98eb5434a9d664805091c96
|
4
|
+
data.tar.gz: ca48e19a321441194515ad781ebcedb5010bca519e53bdfe9469af6a83add301
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fa6587abdac4d639630c0a605704ed76ff5f3373dcf56f83355dcc999913689e6628db690b8004ccdfc510ade6440b7ca088d9e9ac3a71e228a68ce2a8b359f
|
7
|
+
data.tar.gz: 1776ead93436933f732ec46c573ef7ef056c2cb86b9d601ac6574cf252c0a9774a3f78b464ddb8fe32deb61d5f626f4e6a379276898d08176a429def29f90a10
|
@@ -15,8 +15,8 @@ jobs:
|
|
15
15
|
runs-on: macos-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby: ['3.1.6', '3.2.
|
19
|
-
duckdb: ['1.1.
|
18
|
+
ruby: ['3.1.6', '3.2.6', '3.3.6', '3.4.0-preview2', 'head']
|
19
|
+
duckdb: ['1.1.3', '1.1.1', '1.0.0']
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- uses: actions/checkout@v4
|
@@ -15,8 +15,8 @@ jobs:
|
|
15
15
|
runs-on: ubuntu-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby: ['3.1.6', '3.2.
|
19
|
-
duckdb: ['1.1.
|
18
|
+
ruby: ['3.1.6', '3.2.6', '3.3.6', '3.4.0-preview2', 'head']
|
19
|
+
duckdb: ['1.1.3', '1.1.1', '1.0.0']
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- uses: actions/checkout@v4
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
# Unreleased
|
5
5
|
|
6
|
+
# 1.1.3.0 - 2024-11-10
|
7
|
+
- add `DuckDB::PreparedStatement#bind_decimal`. (Thanks to @otegami)
|
8
|
+
- bump duckdb to 1.1.3.
|
9
|
+
|
6
10
|
# 1.1.2.1 - 2024-11-04
|
7
11
|
- `DuckDB::Connection#query` accepts multiple SQL statement.
|
8
12
|
- When multiple SQL statements are given, `DuckDB::Connection#query` returns the last statement result.
|
data/Dockerfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -81,7 +81,6 @@ static VALUE duckdb_extracted_statements_size(VALUE self) {
|
|
81
81
|
return ULL2NUM(ctx->num_statements);
|
82
82
|
}
|
83
83
|
|
84
|
-
|
85
84
|
static VALUE duckdb_extracted_statements_prepared_statement(VALUE self, VALUE con, VALUE index) {
|
86
85
|
rubyDuckDBConnection *pcon;
|
87
86
|
rubyDuckDBExtractedStatements *ctx;
|
data/lib/duckdb/converter.rb
CHANGED
@@ -155,6 +155,19 @@ module DuckDB
|
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
+
def _parse_deciaml(value)
|
159
|
+
case value
|
160
|
+
when BigDecimal
|
161
|
+
value
|
162
|
+
else
|
163
|
+
begin
|
164
|
+
BigDecimal(value.to_s)
|
165
|
+
rescue StandardError => e
|
166
|
+
raise(ArgumentError, "Cannot parse `#{value.inspect}` to BigDecimal object. #{e.message}")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
158
171
|
def _to_query_progress(percentage, rows_processed, total_rows_to_process)
|
159
172
|
DuckDB::QueryProgress.new(percentage, rows_processed, total_rows_to_process).freeze
|
160
173
|
end
|
@@ -171,5 +184,12 @@ module DuckDB
|
|
171
184
|
raise(ArgumentError, "The argument `#{value.inspect}` must be Integer.")
|
172
185
|
end
|
173
186
|
end
|
187
|
+
|
188
|
+
def decimal_to_hugeint(value)
|
189
|
+
integer_value = (value * (10 ** value.scale)).to_i
|
190
|
+
integer_to_hugeint(integer_value)
|
191
|
+
rescue FloatDomainError => e
|
192
|
+
raise(ArgumentError, "The argument `#{value.inspect}` must be converted to Integer. #{e.message}")
|
193
|
+
end
|
174
194
|
end
|
175
195
|
end
|
@@ -216,6 +216,25 @@ module DuckDB
|
|
216
216
|
_bind_interval(index, value.interval_months, value.interval_days, value.interval_micros)
|
217
217
|
end
|
218
218
|
|
219
|
+
# binds i-th parameter with SQL prepared statement.
|
220
|
+
# The first argument is index of parameter.
|
221
|
+
# The index of first parameter is 1 not 0.
|
222
|
+
# The second argument value is to expected BigDecimal value or any value
|
223
|
+
# that can be parsed into a BigDecimal.
|
224
|
+
#
|
225
|
+
# require 'duckdb'
|
226
|
+
# db = DuckDB::Database.open('duckdb_database')
|
227
|
+
# con = db.connect
|
228
|
+
# sql ='SELECT value FROM decimals WHERE decimal = ?'
|
229
|
+
# stmt = PreparedStatement.new(con, sql)
|
230
|
+
# stmt.bind_decimal(1, BigDecimal('987654.321'))
|
231
|
+
def bind_decimal(index, value)
|
232
|
+
decimal = _parse_deciaml(value)
|
233
|
+
lower, upper = decimal_to_hugeint(decimal)
|
234
|
+
width = decimal.to_s('F').gsub(/[^0-9]/, '').length
|
235
|
+
_bind_decimal(index, lower, upper, width, decimal.scale)
|
236
|
+
end
|
237
|
+
|
219
238
|
# binds i-th parameter with SQL prepared statement.
|
220
239
|
# The first argument is index of parameter.
|
221
240
|
# The index of first parameter is 1 not 0.
|
@@ -264,7 +283,7 @@ module DuckDB
|
|
264
283
|
when Date
|
265
284
|
bind_varchar(index, value.strftime('%Y-%m-%d'))
|
266
285
|
when BigDecimal
|
267
|
-
|
286
|
+
bind_decimal(index, value)
|
268
287
|
else
|
269
288
|
raise(DuckDB::Error, "not supported type `#{value}` (#{value.class})")
|
270
289
|
end
|
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.
|
4
|
+
version: 1.1.3.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-
|
11
|
+
date: 2024-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|