duckdb 1.0.0.2 → 1.1.0.1
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 +2 -2
- data/CHANGELOG.md +56 -1
- data/Dockerfile +2 -2
- data/Gemfile.lock +6 -6
- data/README.md +12 -3
- data/benchmark/async_query.rb +0 -2
- data/benchmark/to_intern_ips.rb +0 -1
- data/duckdb.gemspec +1 -1
- data/ext/duckdb/duckdb.c +4 -0
- data/ext/duckdb/extconf.rb +4 -7
- data/ext/duckdb/pending_result.c +7 -0
- data/ext/duckdb/prepared_statement.c +35 -9
- data/ext/duckdb/result.c +59 -278
- data/ext/duckdb/ruby-duckdb.h +6 -0
- data/lib/duckdb/column.rb +2 -38
- data/lib/duckdb/config.rb +47 -49
- data/lib/duckdb/connection.rb +9 -1
- data/lib/duckdb/converter/int_to_sym.rb +127 -0
- data/lib/duckdb/converter.rb +9 -0
- data/lib/duckdb/database.rb +2 -4
- data/lib/duckdb/infinity.rb +8 -0
- data/lib/duckdb/pending_result.rb +16 -5
- data/lib/duckdb/prepared_statement.rb +29 -2
- data/lib/duckdb/result.rb +39 -78
- data/lib/duckdb/version.rb +1 -1
- data/lib/duckdb.rb +1 -0
- data/sample/async_query.rb +0 -1
- data/sample/async_query_stream.rb +0 -1
- metadata +6 -7
- data/benchmark/to_bigdecimal_ips.rb +0 -16
- data/benchmark/to_hugeint_ips.rb +0 -16
- data/benchmark/to_hugeint_profile.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 874174344b2be8ad2eba6fa1e89d2c96827a7e53e0982bacaa7a804b1ee8cf0b
|
4
|
+
data.tar.gz: 9d57293bc3dc59cc10ad7a23ae8e0b8ed4944524c83ecd3e5e9503c6f460d73f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8739a162ec00fb0bb98e13d4f9adecb8f3230e2b4fa81067a128ce4f9db4456b76fe825652ba09b46a5c05fb1f7637a762f369f28f9d7d9423649f7e646b7f0
|
7
|
+
data.tar.gz: 3b564b2aa68cbfcc5eec96d9cc4dd038749d172b28b2329ba20af14610bc1db34a270d3034688dfdf852b26edd0a711d803886e3d731619848d5cd5e6ca331be
|
@@ -15,8 +15,8 @@ jobs:
|
|
15
15
|
runs-on: macos-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby: ['3.
|
19
|
-
duckdb: ['1.0.0', '0.10.3']
|
18
|
+
ruby: ['3.1.6', '3.2.5', '3.3.5', '3.4.0-preview1', 'head']
|
19
|
+
duckdb: ['1.1.0', '1.0.0', '0.10.3']
|
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
|
-
- name: Build test with DUCKDB_API_NO_DEPRECATED and Ruby ${{ matrix.ruby }}
|
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.
|
19
|
-
duckdb: ['1.0.0', '0.10.3']
|
18
|
+
ruby: ['3.1.6', '3.2.5', '3.3.5', '3.4.0-preview1', 'head']
|
19
|
+
duckdb: ['1.1.0', '1.0.0', '0.10.3']
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- uses: actions/checkout@v4
|
@@ -15,8 +15,8 @@ jobs:
|
|
15
15
|
runs-on: windows-latest
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
|
-
ruby: ['3.
|
19
|
-
duckdb: ['1.0.0', '0.10.3']
|
18
|
+
ruby: ['3.1.6', '3.2.5', '3.3.5', 'ucrt', 'mingw', 'mswin', 'head']
|
19
|
+
duckdb: ['1.1.0', '1.0.0', '0.10.3']
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- uses: actions/checkout@v4
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,63 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
|
+
# Unreleased
|
5
|
+
|
6
|
+
# 1.1.0.1 - 2024-09-21
|
7
|
+
- add `DuckDB::Connection#prepare`. `DuckDB::Connection#prepare` is an alias of `DuckDB::Connection#prepared_statement`.
|
8
|
+
|
9
|
+
# 1.1.0.0 - 2024-09-15
|
10
|
+
- drop ruby 3.0.x.
|
11
|
+
- bump duckdb to 1.1.0.
|
12
|
+
- Add `DuckDB::PendingResult#execute_check_state` to check the state of the pending result.
|
13
|
+
- Add `DuckDB::PreparedStatement#clear_bindings` to clear all bindings.
|
14
|
+
- Add `DuckDB::PreparedStatement#param_type` to get the type of the paramerter type.
|
15
|
+
- The return value is one of the `:invalid`, `:boolean`, `:tinyint`, `:smallint`, `:integer`, `:bigint`, `:utinyint`,
|
16
|
+
`:usmallint`, `:uinteger`, `:ubigint`, `:float`, `:double`, `:timestamp`, `:date`, `:time`, `:interval`, `:hugeint`,
|
17
|
+
`:uhugeint`, `:varchar`, `:blob`, `:decimal`, `:timestamp_s`, `:timestamp_ms`, `:timestamp_ns`, `:enum`, `:list`,
|
18
|
+
`:struct`, `:map`, `:array`, `:uuid`, `:union`, `:bit`, `:time_tz`, `:timestamp_tz`.
|
19
|
+
- Add `DuckDB::PreparedStatement#statement_type` to get the type of the statement.
|
20
|
+
- The return value is one of the `:invalid`, `:select`, `:insert`, `:update`, `:explain`, `:delete`, `:prepare`, `:create`,
|
21
|
+
`:execute`, `:alter`, `:transaction`, `:copy`, `:analyze`, `:variable_set`, `:create_func`,
|
22
|
+
`:drop`, `:export`, `:pragma`, `:vacuum`, `:call`, `:set`, `:load`, `:relation`, `:extension`,
|
23
|
+
`:logical_plan`, `:attach`, `:detach`, `:multi`.
|
24
|
+
- Add `DuckDB::Result#statement_type` to get the return type of the statement.
|
25
|
+
- The return value is one of the `:invalid`, `:select`, `:insert`, `:update`, `:explain`, `:delete`, `:prepare`, `:create`,
|
26
|
+
`:execute`, `:alter`, `:transaction`, `:copy`, `:analyze`, `:variable_set`, `:create_func`,
|
27
|
+
`:drop`, `:export`, `:pragma`, `:vacuum`, `:call`, `:set`, `:load`, `:relation`, `:extension`,
|
28
|
+
`:logical_plan`, `:attach`, `:detach`, `:multi`.
|
29
|
+
- Add `DuckDB::Result#return_type` to get the return type of the result.
|
30
|
+
- The return value is one of the `:invalid`, `:query_result`, `:rows_changed`, `:nothing`.
|
31
|
+
- The following method will be deprecated.
|
32
|
+
- `DuckDB::Result#use_chunk_each?`
|
33
|
+
- `DuckDB::Result#use_chunk_each=`
|
4
34
|
|
5
|
-
##
|
35
|
+
## Breaking changes
|
36
|
+
- drop duckdb v0.9.x.
|
37
|
+
- skip to check duckdb_parameter_name is available.
|
38
|
+
- The following methods are obsoleted.
|
39
|
+
- `DuckDB::Result#_null?`
|
40
|
+
- `DuckDB::Result#_to_boolean`
|
41
|
+
- `DuckDB::Result#_to_smallint`
|
42
|
+
- `DuckDB::Result#_to_utinyint`
|
43
|
+
- `DuckDB::Result#_to_integer`
|
44
|
+
- `DuckDB::Result#_to_bigint`
|
45
|
+
- `DuckDB::Result#_to_hugeint`
|
46
|
+
- `DuckDB::Result#_to_hugeint_internal`
|
47
|
+
- `DuckDB::Result#__to_hugeint_internal`
|
48
|
+
- `DuckDB::Result#_to_decimal`
|
49
|
+
- `DuckDB::Result#_to_decimal_internal`
|
50
|
+
- `DuckDB::Result#__to_decimal_internal`
|
51
|
+
- `DuckDB::Result#_to_float`
|
52
|
+
- `DuckDB::Result#_to_double`
|
53
|
+
- `DuckDB::Result#_to_string`
|
54
|
+
- `DuckDB::Result#_to_string_internal`
|
55
|
+
- `DuckDB::Result#_to_blob`
|
56
|
+
- `DuckDB::Result#to_value`
|
57
|
+
- `DuckDB::Result#row`
|
58
|
+
- `DuckDB::Result#use_chunk_each?` is always true.
|
59
|
+
- `DuckDB::Result#use_chunk_each=` always ignores the argument.
|
60
|
+
- `DuckDB::Result#each` always works the same as `DuckDB::Result#chunk_each`.
|
6
61
|
|
7
62
|
# 1.0.0.2 - 2024-06-23
|
8
63
|
- DuckDB::Result supports TIMESTAMPTZ column type (only when DuckDB::Result.use_chunk_each is true).
|
data/Dockerfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
duckdb (1.
|
4
|
+
duckdb (1.1.0.1)
|
5
5
|
bigdecimal (>= 3.1.4)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
benchmark-ips (2.
|
10
|
+
benchmark-ips (2.14.0)
|
11
11
|
bigdecimal (3.1.8)
|
12
12
|
mini_portile2 (2.8.7)
|
13
|
-
minitest (5.
|
14
|
-
nokogiri (1.16.
|
13
|
+
minitest (5.25.1)
|
14
|
+
nokogiri (1.16.7)
|
15
15
|
mini_portile2 (~> 2.8.2)
|
16
16
|
racc (~> 1.4)
|
17
|
-
nokogiri (1.16.
|
17
|
+
nokogiri (1.16.7-x86_64-linux)
|
18
18
|
racc (~> 1.4)
|
19
|
-
racc (1.8.
|
19
|
+
racc (1.8.1)
|
20
20
|
rake (13.2.1)
|
21
21
|
rake-compiler (1.2.7)
|
22
22
|
rake
|
data/README.md
CHANGED
@@ -113,15 +113,24 @@ con.query('SELECT * FROM users WHERE name = ? AND email = ?', 'Alice', 'alice@ex
|
|
113
113
|
# or
|
114
114
|
con.query('SELECT * FROM users WHERE name = $name AND email = $email', name: 'Alice', email: 'alice@example.com')
|
115
115
|
```
|
116
|
+
### Using prepared statement
|
116
117
|
|
118
|
+
You can use prepared statement.
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
stmt = con.prepare('SELECT * FROM users WHERE name = $name AND email = $email')
|
122
|
+
# or
|
123
|
+
# stmt = con.prepared_statement('SELECT * FROM users WHERE name = $name AND email = $email')
|
124
|
+
# or
|
125
|
+
# stmt = DuckDB::PreparedStatement.new(con, 'SELECT * FROM users WHERE name = $name AND email = $email')
|
126
|
+
stmt.bind(name: 'Alice', email: 'alice@example.com')
|
127
|
+
result = stmt.execute
|
128
|
+
```
|
117
129
|
### Using async query
|
118
130
|
|
119
131
|
You can use async query.
|
120
132
|
|
121
133
|
```ruby
|
122
|
-
DuckDB::Result.use_chunk_each = true
|
123
|
-
...
|
124
|
-
|
125
134
|
pending_result = con.async_query_stream('SLOW QUERY')
|
126
135
|
pending_result.execute_task while pending_result.state == :not_ready
|
127
136
|
|
data/benchmark/async_query.rb
CHANGED
data/benchmark/to_intern_ips.rb
CHANGED
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 = '>= 3.
|
29
|
+
spec.required_ruby_version = '>= 3.1.0'
|
30
30
|
spec.add_dependency 'bigdecimal', '>= 3.1.4'
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 2.3'
|
data/ext/duckdb/duckdb.c
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#include "ruby-duckdb.h"
|
2
2
|
|
3
3
|
VALUE mDuckDB;
|
4
|
+
VALUE PositiveInfinity;
|
5
|
+
VALUE NegativeInfinity;
|
4
6
|
|
5
7
|
static VALUE duckdb_s_library_version(VALUE self);
|
6
8
|
|
@@ -19,6 +21,8 @@ static VALUE duckdb_s_library_version(VALUE self) {
|
|
19
21
|
void
|
20
22
|
Init_duckdb_native(void) {
|
21
23
|
mDuckDB = rb_define_module("DuckDB");
|
24
|
+
PositiveInfinity = rb_str_new_literal("infinity");
|
25
|
+
NegativeInfinity = rb_str_new_literal("-infinity");
|
22
26
|
|
23
27
|
rb_define_singleton_method(mDuckDB, "library_version", duckdb_s_library_version, 0);
|
24
28
|
|
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 = '0.10.0'
|
6
6
|
|
7
7
|
def check_duckdb_header(header, version)
|
8
8
|
found = find_header(
|
@@ -56,10 +56,7 @@ end
|
|
56
56
|
dir_config('duckdb')
|
57
57
|
|
58
58
|
check_duckdb_header('duckdb.h', DUCKDB_REQUIRED_VERSION)
|
59
|
-
check_duckdb_library('duckdb', '
|
60
|
-
|
61
|
-
# check duckdb >= 0.9.0
|
62
|
-
have_func('duckdb_bind_parameter_index', 'duckdb.h')
|
59
|
+
check_duckdb_library('duckdb', 'duckdb_appender_column_count', DUCKDB_REQUIRED_VERSION)
|
63
60
|
|
64
61
|
# check duckdb >= 0.10.0
|
65
62
|
have_func('duckdb_appender_column_count', 'duckdb.h')
|
@@ -67,8 +64,8 @@ have_func('duckdb_appender_column_count', 'duckdb.h')
|
|
67
64
|
# check duckdb >= 1.0.0
|
68
65
|
have_func('duckdb_fetch_chunk', 'duckdb.h')
|
69
66
|
|
70
|
-
#
|
71
|
-
have_func('
|
67
|
+
# check duckdb >= 1.1.0
|
68
|
+
have_func('duckdb_result_error_type', 'duckdb.h')
|
72
69
|
|
73
70
|
$CFLAGS << ' -DDUCKDB_API_NO_DEPRECATED' if ENV['DUCKDB_API_NO_DEPRECATED']
|
74
71
|
|
data/ext/duckdb/pending_result.c
CHANGED
@@ -10,6 +10,7 @@ static VALUE duckdb_pending_result_execute_task(VALUE self);
|
|
10
10
|
static VALUE duckdb_pending_result_execute_pending(VALUE self);
|
11
11
|
static VALUE duckdb_pending_result_execution_finished_p(VALUE self);
|
12
12
|
static VALUE duckdb_pending_result__state(VALUE self);
|
13
|
+
static VALUE duckdb_pending_result__execute_check_state(VALUE self);
|
13
14
|
|
14
15
|
static const rb_data_type_t pending_result_data_type = {
|
15
16
|
"DuckDB/PendingResult",
|
@@ -128,6 +129,11 @@ static VALUE duckdb_pending_result__state(VALUE self) {
|
|
128
129
|
return INT2FIX(ctx->state);
|
129
130
|
}
|
130
131
|
|
132
|
+
static VALUE duckdb_pending_result__execute_check_state(VALUE self) {
|
133
|
+
rubyDuckDBPendingResult *ctx = get_struct_pending_result(self);
|
134
|
+
return INT2FIX(duckdb_pending_execute_check_state(ctx->pending_result));
|
135
|
+
}
|
136
|
+
|
131
137
|
rubyDuckDBPendingResult *get_struct_pending_result(VALUE obj) {
|
132
138
|
rubyDuckDBPendingResult *ctx;
|
133
139
|
TypedData_Get_Struct(obj, rubyDuckDBPendingResult, &pending_result_data_type, ctx);
|
@@ -143,4 +149,5 @@ void rbduckdb_init_duckdb_pending_result(void) {
|
|
143
149
|
rb_define_method(cDuckDBPendingResult, "execute_pending", duckdb_pending_result_execute_pending, 0);
|
144
150
|
rb_define_method(cDuckDBPendingResult, "execution_finished?", duckdb_pending_result_execution_finished_p, 0);
|
145
151
|
rb_define_private_method(cDuckDBPendingResult, "_state", duckdb_pending_result__state, 0);
|
152
|
+
rb_define_private_method(cDuckDBPendingResult, "_execute_check_state", duckdb_pending_result__execute_check_state, 0);
|
146
153
|
}
|
@@ -11,10 +11,8 @@ static VALUE duckdb_prepared_statement_execute(VALUE self);
|
|
11
11
|
static idx_t check_index(VALUE vidx);
|
12
12
|
|
13
13
|
static VALUE duckdb_prepared_statement_bind_parameter_index(VALUE self, VALUE name);
|
14
|
-
#ifdef HAVE_DUCKDB_PARAMETER_NAME
|
15
14
|
static VALUE duckdb_prepared_statement_parameter_name(VALUE self, VALUE vidx);
|
16
|
-
|
17
|
-
|
15
|
+
static VALUE duckdb_prepared_statement_clear_bindings(VALUE self);
|
18
16
|
static VALUE duckdb_prepared_statement_bind_bool(VALUE self, VALUE vidx, VALUE val);
|
19
17
|
static VALUE duckdb_prepared_statement_bind_int8(VALUE self, VALUE vidx, VALUE val);
|
20
18
|
static VALUE duckdb_prepared_statement_bind_int16(VALUE self, VALUE vidx, VALUE val);
|
@@ -25,6 +23,8 @@ static VALUE duckdb_prepared_statement_bind_double(VALUE self, VALUE vidx, VALUE
|
|
25
23
|
static VALUE duckdb_prepared_statement_bind_varchar(VALUE self, VALUE vidx, VALUE str);
|
26
24
|
static VALUE duckdb_prepared_statement_bind_blob(VALUE self, VALUE vidx, VALUE blob);
|
27
25
|
static VALUE duckdb_prepared_statement_bind_null(VALUE self, VALUE vidx);
|
26
|
+
static VALUE duckdb_prepared_statement__statement_type(VALUE self);
|
27
|
+
static VALUE duckdb_prepared_statement__param_type(VALUE self, VALUE vidx);
|
28
28
|
static VALUE duckdb_prepared_statement__bind_date(VALUE self, VALUE vidx, VALUE year, VALUE month, VALUE day);
|
29
29
|
static VALUE duckdb_prepared_statement__bind_time(VALUE self, VALUE vidx, VALUE hour, VALUE min, VALUE sec, VALUE micros);
|
30
30
|
static VALUE duckdb_prepared_statement__bind_timestamp(VALUE self, VALUE vidx, VALUE year, VALUE month, VALUE day, VALUE hour, VALUE min, VALUE sec, VALUE micros);
|
@@ -125,7 +125,6 @@ static VALUE duckdb_prepared_statement_bind_parameter_index(VALUE self, VALUE na
|
|
125
125
|
return ULL2NUM(idx);
|
126
126
|
}
|
127
127
|
|
128
|
-
#ifdef HAVE_DUCKDB_PARAMETER_NAME
|
129
128
|
static VALUE duckdb_prepared_statement_parameter_name(VALUE self, VALUE vidx) {
|
130
129
|
rubyDuckDBPreparedStatement *ctx;
|
131
130
|
VALUE vname;
|
@@ -142,7 +141,23 @@ static VALUE duckdb_prepared_statement_parameter_name(VALUE self, VALUE vidx) {
|
|
142
141
|
duckdb_free((void *)name);
|
143
142
|
return vname;
|
144
143
|
}
|
145
|
-
|
144
|
+
|
145
|
+
/*
|
146
|
+
* call-seq:
|
147
|
+
* prepared_statement.clear_bindings -> DuckDB::PreparedStatement
|
148
|
+
*
|
149
|
+
* clear all bindings of prepared statement.
|
150
|
+
*/
|
151
|
+
static VALUE duckdb_prepared_statement_clear_bindings(VALUE self) {
|
152
|
+
rubyDuckDBPreparedStatement *ctx;
|
153
|
+
TypedData_Get_Struct(self, rubyDuckDBPreparedStatement, &prepared_statement_data_type, ctx);
|
154
|
+
|
155
|
+
if (duckdb_clear_bindings(ctx->prepared_statement) == DuckDBError) {
|
156
|
+
const char *error = duckdb_prepare_error(ctx->prepared_statement);
|
157
|
+
rb_raise(eDuckDBError, "fail to clear bindings. %s", error);
|
158
|
+
}
|
159
|
+
return self;
|
160
|
+
}
|
146
161
|
|
147
162
|
static VALUE duckdb_prepared_statement_bind_bool(VALUE self, VALUE vidx, VALUE val) {
|
148
163
|
rubyDuckDBPreparedStatement *ctx;
|
@@ -273,6 +288,18 @@ static VALUE duckdb_prepared_statement_bind_null(VALUE self, VALUE vidx) {
|
|
273
288
|
return self;
|
274
289
|
}
|
275
290
|
|
291
|
+
static VALUE duckdb_prepared_statement__statement_type(VALUE self) {
|
292
|
+
rubyDuckDBPreparedStatement *ctx;
|
293
|
+
TypedData_Get_Struct(self, rubyDuckDBPreparedStatement, &prepared_statement_data_type, ctx);
|
294
|
+
return INT2FIX(duckdb_prepared_statement_type(ctx->prepared_statement));
|
295
|
+
}
|
296
|
+
|
297
|
+
static VALUE duckdb_prepared_statement__param_type(VALUE self, VALUE vidx) {
|
298
|
+
rubyDuckDBPreparedStatement *ctx;
|
299
|
+
TypedData_Get_Struct(self, rubyDuckDBPreparedStatement, &prepared_statement_data_type, ctx);
|
300
|
+
return INT2FIX(duckdb_param_type(ctx->prepared_statement, NUM2ULL(vidx)));
|
301
|
+
}
|
302
|
+
|
276
303
|
static VALUE duckdb_prepared_statement__bind_date(VALUE self, VALUE vidx, VALUE year, VALUE month, VALUE day) {
|
277
304
|
rubyDuckDBPreparedStatement *ctx;
|
278
305
|
duckdb_date dt;
|
@@ -366,11 +393,8 @@ void rbduckdb_init_duckdb_prepared_statement(void) {
|
|
366
393
|
rb_define_method(cDuckDBPreparedStatement, "execute", duckdb_prepared_statement_execute, 0);
|
367
394
|
rb_define_method(cDuckDBPreparedStatement, "nparams", duckdb_prepared_statement_nparams, 0);
|
368
395
|
rb_define_method(cDuckDBPreparedStatement, "bind_parameter_index", duckdb_prepared_statement_bind_parameter_index, 1);
|
369
|
-
|
370
|
-
#ifdef HAVE_DUCKDB_PARAMETER_NAME
|
371
396
|
rb_define_method(cDuckDBPreparedStatement, "parameter_name", duckdb_prepared_statement_parameter_name, 1);
|
372
|
-
|
373
|
-
|
397
|
+
rb_define_method(cDuckDBPreparedStatement, "clear_bindings", duckdb_prepared_statement_clear_bindings, 0);
|
374
398
|
rb_define_method(cDuckDBPreparedStatement, "bind_bool", duckdb_prepared_statement_bind_bool, 2);
|
375
399
|
rb_define_method(cDuckDBPreparedStatement, "bind_int8", duckdb_prepared_statement_bind_int8, 2);
|
376
400
|
rb_define_method(cDuckDBPreparedStatement, "bind_int16", duckdb_prepared_statement_bind_int16, 2);
|
@@ -381,6 +405,8 @@ void rbduckdb_init_duckdb_prepared_statement(void) {
|
|
381
405
|
rb_define_method(cDuckDBPreparedStatement, "bind_varchar", duckdb_prepared_statement_bind_varchar, 2);
|
382
406
|
rb_define_method(cDuckDBPreparedStatement, "bind_blob", duckdb_prepared_statement_bind_blob, 2);
|
383
407
|
rb_define_method(cDuckDBPreparedStatement, "bind_null", duckdb_prepared_statement_bind_null, 1);
|
408
|
+
rb_define_private_method(cDuckDBPreparedStatement, "_statement_type", duckdb_prepared_statement__statement_type, 0);
|
409
|
+
rb_define_private_method(cDuckDBPreparedStatement, "_param_type", duckdb_prepared_statement__param_type, 1);
|
384
410
|
rb_define_private_method(cDuckDBPreparedStatement, "_bind_date", duckdb_prepared_statement__bind_date, 4);
|
385
411
|
rb_define_private_method(cDuckDBPreparedStatement, "_bind_time", duckdb_prepared_statement__bind_time, 5);
|
386
412
|
rb_define_private_method(cDuckDBPreparedStatement, "_bind_timestamp", duckdb_prepared_statement__bind_timestamp, 8);
|