duckdb 0.0.6 → 0.0.7
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_by_github.yml +14 -33
- data/.travis.yml +3 -6
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/ext/duckdb/connection.c +34 -0
- data/ext/duckdb/database.c +22 -2
- data/ext/duckdb/database.h +2 -0
- data/ext/duckdb/extconf.rb +0 -1
- data/ext/duckdb/prepared_statement.c +10 -15
- data/ext/duckdb/prepared_statement.h +1 -1
- data/ext/duckdb/result.c +10 -10
- data/lib/duckdb.rb +1 -1
- data/lib/duckdb/connection.rb +2 -0
- 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: 0a27e917703a870dba56470e00cb4ae70f5b62dcb256d39da63cc88a0a888b5e
|
|
4
|
+
data.tar.gz: 8dc0b2f58cc6345540d62cdee126951de02e83b61d555da747ebc7f9a3d486a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45ee35ed43062e134e6c672f16ad92c99a7552607ed221795be8a22bc1b0b33b58b946e323cffc07fb032ad00833f1ec6b667fdceac537cf2dd1968663c44dd7
|
|
7
|
+
data.tar.gz: b57c3c55f4cda72fddf72909b16182448b5466c0d14b59afc2776f312c8640af6353786e862a086d782fe9f6f4670fd7d8f6d03fe6f8be47464b3aadcf039d7c
|
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
11
|
ruby: ['2.5.x', '2.6.x']
|
|
12
|
-
duckdb: ['0.1.
|
|
12
|
+
duckdb: ['0.1.5']
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
15
|
- uses: actions/checkout@v1
|
|
@@ -19,43 +19,24 @@ jobs:
|
|
|
19
19
|
with:
|
|
20
20
|
ruby-version: ${{ matrix.ruby }}
|
|
21
21
|
|
|
22
|
-
- name: duckdb 0.1.
|
|
23
|
-
id: duckdb-cache-
|
|
22
|
+
- name: duckdb 0.1.5 cache
|
|
23
|
+
id: duckdb-cache-v0_1_5
|
|
24
24
|
uses: actions/cache@v1.1.0
|
|
25
25
|
with:
|
|
26
|
-
path: duckdb-v0.1.
|
|
27
|
-
key: ${{ runner.os }}-duckdb-
|
|
26
|
+
path: duckdb-v0.1.5
|
|
27
|
+
key: ${{ runner.os }}-duckdb-v0_1_5_001
|
|
28
28
|
restore-keys: |
|
|
29
|
-
${{ runner.os }}-duckdb-
|
|
29
|
+
${{ runner.os }}-duckdb-v0_1_5
|
|
30
30
|
|
|
31
|
-
- name: Build duckdb 0.1.
|
|
32
|
-
if: steps.duckdb-cache-
|
|
31
|
+
- name: Build duckdb 0.1.5
|
|
32
|
+
if: steps.duckdb-cache-v0_1_5.outputs.cache-hit != 'true'
|
|
33
33
|
run: |
|
|
34
|
-
git clone -b v0.1.
|
|
35
|
-
cd duckdb-tmp-v0.1.
|
|
36
|
-
rm -rf duckdb-v0.1.
|
|
37
|
-
mkdir -p duckdb-v0.1.
|
|
38
|
-
cp -rip duckdb-tmp-v0.1.
|
|
39
|
-
cp -rip duckdb-tmp-v0.1.
|
|
40
|
-
|
|
41
|
-
- name: duckdb 0.1.3 cache
|
|
42
|
-
id: duckdb-cache-v0_1_3
|
|
43
|
-
uses: actions/cache@v1.1.0
|
|
44
|
-
with:
|
|
45
|
-
path: duckdb-v0.1.3
|
|
46
|
-
key: ${{ runner.os }}-duckdb-v0_1_3_001
|
|
47
|
-
restore-keys: |
|
|
48
|
-
${{ runner.os }}-duckdb-v0_1_3
|
|
49
|
-
|
|
50
|
-
- name: Build duckdb 0.1.3
|
|
51
|
-
if: steps.duckdb-cache-v0_1_3.outputs.cache-hit != 'true'
|
|
52
|
-
run: |
|
|
53
|
-
git clone -b v0.1.3 https://github.com/cwida/duckdb.git duckdb-tmp-v0.1.3
|
|
54
|
-
cd duckdb-tmp-v0.1.3 && make && cd ..
|
|
55
|
-
rm -rf duckdb-v0.1.3
|
|
56
|
-
mkdir -p duckdb-v0.1.3/build/release/src duckdb-v0.1.3/src
|
|
57
|
-
cp -rip duckdb-tmp-v0.1.3/build/release/src/*.so duckdb-v0.1.3/build/release/src
|
|
58
|
-
cp -rip duckdb-tmp-v0.1.3/src/include duckdb-v0.1.3/src/
|
|
34
|
+
git clone -b v0.1.5 https://github.com/cwida/duckdb.git duckdb-tmp-v0.1.5
|
|
35
|
+
cd duckdb-tmp-v0.1.5 && make && cd ..
|
|
36
|
+
rm -rf duckdb-v0.1.5
|
|
37
|
+
mkdir -p duckdb-v0.1.5/build/release/src duckdb-v0.1.5/src
|
|
38
|
+
cp -rip duckdb-tmp-v0.1.5/build/release/src/*.so duckdb-v0.1.5/build/release/src
|
|
39
|
+
cp -rip duckdb-tmp-v0.1.5/src/include duckdb-v0.1.5/src/
|
|
59
40
|
|
|
60
41
|
- name: Build and test with Rake with Ruby ${{ matrix.ruby }}
|
|
61
42
|
env:
|
data/.travis.yml
CHANGED
|
@@ -2,16 +2,13 @@ language: ruby
|
|
|
2
2
|
cache:
|
|
3
3
|
bundler: true
|
|
4
4
|
directories:
|
|
5
|
-
- ${HOME}/duckdb-v0.1.
|
|
6
|
-
- ${HOME}/duckdb-v0.1.3
|
|
5
|
+
- ${HOME}/duckdb-v0.1.5
|
|
7
6
|
before_install:
|
|
8
7
|
- yes | gem update --system
|
|
9
|
-
- if [[ ! -d ${HOME}/duckdb-v0.1.
|
|
10
|
-
- if [[ ! -d ${HOME}/duckdb-v0.1.3/build ]]; then cd ${HOME} && git clone -b v0.1.3 https://github.com/cwida/duckdb.git duckdb-v0.1.3 && cd duckdb-v0.1.3 && make && cd ${TRAVIS_BUILD_DIR}; fi
|
|
8
|
+
- if [[ ! -d ${HOME}/duckdb-v0.1.5/build ]]; then cd ${HOME} && git clone -b v0.1.5 https://github.com/cwida/duckdb.git duckdb-v0.1.5 && cd duckdb-v0.1.5 && make && cd ${TRAVIS_BUILD_DIR}; fi
|
|
11
9
|
|
|
12
10
|
env:
|
|
13
|
-
- DUCKDB_VERSION=0.1.
|
|
14
|
-
- DUCKDB_VERSION=0.1.3
|
|
11
|
+
- DUCKDB_VERSION=0.1.5
|
|
15
12
|
rvm:
|
|
16
13
|
- 2.5.7
|
|
17
14
|
- 2.6.5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# ChangeLog
|
|
2
2
|
|
|
3
|
+
## 0.0.7
|
|
4
|
+
|
|
5
|
+
- bump DuckDB to v0.1.5
|
|
6
|
+
- DuckDB version must be 0.1.5 or later.
|
|
7
|
+
- add DuckDB::Connection#connect, alias method open
|
|
8
|
+
- add DuckDB::Connection#disconnect, alias method close
|
|
9
|
+
- add DuckDB::Database#close
|
|
10
|
+
|
|
3
11
|
## 0.0.6
|
|
4
12
|
|
|
5
13
|
- add alias `execute` of `DuckDB::Connection#query`
|
data/Gemfile.lock
CHANGED
data/ext/duckdb/connection.c
CHANGED
|
@@ -33,6 +33,34 @@ VALUE create_connection(VALUE oDuckDBDatabase)
|
|
|
33
33
|
return obj;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
static VALUE duckdb_connection_disconnect(VALUE self)
|
|
37
|
+
{
|
|
38
|
+
rubyDuckDBConnection *ctx;
|
|
39
|
+
|
|
40
|
+
Data_Get_Struct(self, rubyDuckDBConnection, ctx);
|
|
41
|
+
duckdb_disconnect(&(ctx->con));
|
|
42
|
+
|
|
43
|
+
return self;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase)
|
|
47
|
+
{
|
|
48
|
+
rubyDuckDBConnection *ctx;
|
|
49
|
+
rubyDuckDB *ctxdb;
|
|
50
|
+
|
|
51
|
+
if (!rb_obj_is_kind_of(oDuckDBDatabase, cDuckDBDatabase)) {
|
|
52
|
+
rb_raise(rb_eTypeError, "The first argument must be DuckDB::Database object.");
|
|
53
|
+
}
|
|
54
|
+
Data_Get_Struct(oDuckDBDatabase, rubyDuckDB, ctxdb);
|
|
55
|
+
Data_Get_Struct(self, rubyDuckDBConnection, ctx);
|
|
56
|
+
|
|
57
|
+
if (duckdb_connect(ctxdb->db, &(ctx->con)) == DuckDBError) {
|
|
58
|
+
rb_raise(eDuckDBError, "connection error");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return self;
|
|
62
|
+
}
|
|
63
|
+
|
|
36
64
|
static VALUE duckdb_connection_query_sql(VALUE self, VALUE str)
|
|
37
65
|
{
|
|
38
66
|
rubyDuckDBConnection *ctx;
|
|
@@ -43,6 +71,10 @@ static VALUE duckdb_connection_query_sql(VALUE self, VALUE str)
|
|
|
43
71
|
Data_Get_Struct(self, rubyDuckDBConnection, ctx);
|
|
44
72
|
Data_Get_Struct(result, rubyDuckDBResult, ctxr);
|
|
45
73
|
|
|
74
|
+
if (!(ctx->con)) {
|
|
75
|
+
rb_raise(eDuckDBError, "Database connection closed");
|
|
76
|
+
}
|
|
77
|
+
|
|
46
78
|
if (duckdb_query(ctx->con, StringValueCStr(str), &(ctxr->result)) == DuckDBError) {
|
|
47
79
|
rb_raise(eDuckDBError, "%s", ctxr->result.error_message);
|
|
48
80
|
}
|
|
@@ -54,5 +86,7 @@ void init_duckdb_connection(void)
|
|
|
54
86
|
cDuckDBConnection = rb_define_class_under(mDuckDB, "Connection", rb_cObject);
|
|
55
87
|
rb_define_alloc_func(cDuckDBConnection, allocate);
|
|
56
88
|
|
|
89
|
+
rb_define_method(cDuckDBConnection, "disconnect", duckdb_connection_disconnect, 0);
|
|
90
|
+
rb_define_method(cDuckDBConnection, "connect", duckdb_connection_connect, 1);
|
|
57
91
|
rb_define_private_method(cDuckDBConnection, "query_sql", duckdb_connection_query_sql, 1);
|
|
58
92
|
}
|
data/ext/duckdb/database.c
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
#include "ruby-duckdb.h"
|
|
2
2
|
|
|
3
|
+
static void close_database(rubyDuckDB *p)
|
|
4
|
+
{
|
|
5
|
+
duckdb_close(&(p->db));
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
static void deallocate(void * ctx)
|
|
4
9
|
{
|
|
5
10
|
rubyDuckDB *p = (rubyDuckDB *)ctx;
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
close_database(p);
|
|
8
13
|
xfree(p);
|
|
9
14
|
}
|
|
10
15
|
|
|
@@ -41,10 +46,25 @@ static VALUE duckdb_database_connect(VALUE self)
|
|
|
41
46
|
return create_connection(self);
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
/*
|
|
50
|
+
* call-seq:
|
|
51
|
+
* duckdb.close -> DuckDB::Database
|
|
52
|
+
*
|
|
53
|
+
* closes DuckDB database.
|
|
54
|
+
*/
|
|
55
|
+
static VALUE duckdb_database_close(VALUE self)
|
|
56
|
+
{
|
|
57
|
+
rubyDuckDB *ctx;
|
|
58
|
+
Data_Get_Struct(self, rubyDuckDB, ctx);
|
|
59
|
+
close_database(ctx);
|
|
60
|
+
return self;
|
|
61
|
+
}
|
|
62
|
+
|
|
44
63
|
void init_duckdb_database(void)
|
|
45
64
|
{
|
|
46
|
-
|
|
65
|
+
cDuckDBDatabase = rb_define_class_under(mDuckDB, "Database", rb_cObject);
|
|
47
66
|
rb_define_alloc_func(cDuckDBDatabase, allocate);
|
|
48
67
|
rb_define_singleton_method(cDuckDBDatabase, "open", duckdb_database_s_open, -1);
|
|
49
68
|
rb_define_method(cDuckDBDatabase, "connect", duckdb_database_connect, 0);
|
|
69
|
+
rb_define_method(cDuckDBDatabase, "close", duckdb_database_close, 0);
|
|
50
70
|
}
|
data/ext/duckdb/database.h
CHANGED
data/ext/duckdb/extconf.rb
CHANGED
|
@@ -61,9 +61,9 @@ static VALUE duckdb_prepared_statement_execute(VALUE self)
|
|
|
61
61
|
return result;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
static
|
|
64
|
+
static idx_t check_index(VALUE vidx)
|
|
65
65
|
{
|
|
66
|
-
|
|
66
|
+
idx_t idx = FIX2INT(vidx);
|
|
67
67
|
if (idx <= 0) {
|
|
68
68
|
rb_raise(rb_eArgError, "index of parameter must be greater than 0");
|
|
69
69
|
}
|
|
@@ -73,7 +73,7 @@ static index_t check_index(VALUE vidx)
|
|
|
73
73
|
static VALUE duckdb_prepared_statement_bind_boolean(VALUE self, VALUE vidx, VALUE val)
|
|
74
74
|
{
|
|
75
75
|
rubyDuckDBPreparedStatement *ctx;
|
|
76
|
-
|
|
76
|
+
idx_t idx = check_index(vidx);
|
|
77
77
|
|
|
78
78
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
79
79
|
if (val != Qtrue && val != Qfalse) {
|
|
@@ -89,7 +89,7 @@ static VALUE duckdb_prepared_statement_bind_boolean(VALUE self, VALUE vidx, VALU
|
|
|
89
89
|
static VALUE duckdb_prepared_statement_bind_int16(VALUE self, VALUE vidx, VALUE val)
|
|
90
90
|
{
|
|
91
91
|
rubyDuckDBPreparedStatement *ctx;
|
|
92
|
-
|
|
92
|
+
idx_t idx = check_index(vidx);
|
|
93
93
|
int16_t i16val = NUM2INT(val);
|
|
94
94
|
|
|
95
95
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
@@ -103,7 +103,7 @@ static VALUE duckdb_prepared_statement_bind_int16(VALUE self, VALUE vidx, VALUE
|
|
|
103
103
|
static VALUE duckdb_prepared_statement_bind_int32(VALUE self, VALUE vidx, VALUE val)
|
|
104
104
|
{
|
|
105
105
|
rubyDuckDBPreparedStatement *ctx;
|
|
106
|
-
|
|
106
|
+
idx_t idx = check_index(vidx);
|
|
107
107
|
int32_t i32val = NUM2LONG(val);
|
|
108
108
|
|
|
109
109
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
@@ -117,7 +117,7 @@ static VALUE duckdb_prepared_statement_bind_int32(VALUE self, VALUE vidx, VALUE
|
|
|
117
117
|
static VALUE duckdb_prepared_statement_bind_int64(VALUE self, VALUE vidx, VALUE val)
|
|
118
118
|
{
|
|
119
119
|
rubyDuckDBPreparedStatement *ctx;
|
|
120
|
-
|
|
120
|
+
idx_t idx = check_index(vidx);
|
|
121
121
|
int64_t i64val = NUM2LL(val);
|
|
122
122
|
|
|
123
123
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
@@ -131,7 +131,7 @@ static VALUE duckdb_prepared_statement_bind_int64(VALUE self, VALUE vidx, VALUE
|
|
|
131
131
|
static VALUE duckdb_prepared_statement_bind_float(VALUE self, VALUE vidx, VALUE val)
|
|
132
132
|
{
|
|
133
133
|
rubyDuckDBPreparedStatement *ctx;
|
|
134
|
-
|
|
134
|
+
idx_t idx = check_index(vidx);
|
|
135
135
|
double dbl = NUM2DBL(val);
|
|
136
136
|
|
|
137
137
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
@@ -145,7 +145,7 @@ static VALUE duckdb_prepared_statement_bind_float(VALUE self, VALUE vidx, VALUE
|
|
|
145
145
|
static VALUE duckdb_prepared_statement_bind_double(VALUE self, VALUE vidx, VALUE val)
|
|
146
146
|
{
|
|
147
147
|
rubyDuckDBPreparedStatement *ctx;
|
|
148
|
-
|
|
148
|
+
idx_t idx = check_index(vidx);
|
|
149
149
|
double dbl = NUM2DBL(val);
|
|
150
150
|
|
|
151
151
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
@@ -159,7 +159,7 @@ static VALUE duckdb_prepared_statement_bind_double(VALUE self, VALUE vidx, VALUE
|
|
|
159
159
|
static VALUE duckdb_prepared_statement_bind_varchar(VALUE self, VALUE vidx, VALUE str)
|
|
160
160
|
{
|
|
161
161
|
rubyDuckDBPreparedStatement *ctx;
|
|
162
|
-
|
|
162
|
+
idx_t idx = check_index(vidx);
|
|
163
163
|
|
|
164
164
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
165
165
|
if (duckdb_bind_varchar(ctx->prepared_statement, idx, StringValuePtr(str)) == DuckDBError) {
|
|
@@ -168,11 +168,10 @@ static VALUE duckdb_prepared_statement_bind_varchar(VALUE self, VALUE vidx, VALU
|
|
|
168
168
|
return self;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
#ifdef HAVE_DUCKDB_BIND_NULL
|
|
172
171
|
static VALUE duckdb_prepared_statement_bind_null(VALUE self, VALUE vidx)
|
|
173
172
|
{
|
|
174
173
|
rubyDuckDBPreparedStatement *ctx;
|
|
175
|
-
|
|
174
|
+
idx_t idx = check_index(vidx);
|
|
176
175
|
|
|
177
176
|
Data_Get_Struct(self, rubyDuckDBPreparedStatement, ctx);
|
|
178
177
|
if (duckdb_bind_null(ctx->prepared_statement, idx) == DuckDBError) {
|
|
@@ -180,7 +179,6 @@ static VALUE duckdb_prepared_statement_bind_null(VALUE self, VALUE vidx)
|
|
|
180
179
|
}
|
|
181
180
|
return self;
|
|
182
181
|
}
|
|
183
|
-
#endif
|
|
184
182
|
|
|
185
183
|
void init_duckdb_prepared_statement(void)
|
|
186
184
|
{
|
|
@@ -198,8 +196,5 @@ void init_duckdb_prepared_statement(void)
|
|
|
198
196
|
rb_define_method(cDuckDBPreparedStatement, "bind_float", duckdb_prepared_statement_bind_float, 2);
|
|
199
197
|
rb_define_method(cDuckDBPreparedStatement, "bind_double", duckdb_prepared_statement_bind_double, 2);
|
|
200
198
|
rb_define_method(cDuckDBPreparedStatement, "bind_varchar", duckdb_prepared_statement_bind_varchar, 2);
|
|
201
|
-
#ifdef HAVE_DUCKDB_BIND_NULL
|
|
202
|
-
/* duckdb version > 0.1.1 */
|
|
203
199
|
rb_define_method(cDuckDBPreparedStatement, "bind_null", duckdb_prepared_statement_bind_null, 1);
|
|
204
|
-
#endif
|
|
205
200
|
}
|
data/ext/duckdb/result.c
CHANGED
|
@@ -16,43 +16,43 @@ static VALUE allocate(VALUE klass)
|
|
|
16
16
|
return Data_Wrap_Struct(klass, NULL, deallocate, ctx);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
static VALUE to_ruby_obj_boolean(duckdb_result *result,
|
|
19
|
+
static VALUE to_ruby_obj_boolean(duckdb_result *result, idx_t col_idx, idx_t row_idx)
|
|
20
20
|
{
|
|
21
21
|
bool bval = duckdb_value_boolean(result, col_idx, row_idx);
|
|
22
22
|
return bval ? Qtrue : Qnil;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
static VALUE to_ruby_obj_smallint(duckdb_result *result,
|
|
25
|
+
static VALUE to_ruby_obj_smallint(duckdb_result *result, idx_t col_idx, idx_t row_idx)
|
|
26
26
|
{
|
|
27
27
|
int16_t i16val = duckdb_value_int16(result, col_idx, row_idx);
|
|
28
28
|
return INT2FIX(i16val);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
static VALUE to_ruby_obj_integer(duckdb_result *result,
|
|
31
|
+
static VALUE to_ruby_obj_integer(duckdb_result *result, idx_t col_idx, idx_t row_idx)
|
|
32
32
|
{
|
|
33
33
|
int32_t i32val = duckdb_value_int32(result, col_idx, row_idx);
|
|
34
34
|
return INT2NUM(i32val);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
static VALUE to_ruby_obj_bigint(duckdb_result *result,
|
|
37
|
+
static VALUE to_ruby_obj_bigint(duckdb_result *result, idx_t col_idx, idx_t row_idx)
|
|
38
38
|
{
|
|
39
39
|
int64_t i64val = duckdb_value_int64(result, col_idx, row_idx);
|
|
40
40
|
return rb_int2big(i64val);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
static VALUE to_ruby_obj_float(duckdb_result *result,
|
|
43
|
+
static VALUE to_ruby_obj_float(duckdb_result *result, idx_t col_idx, idx_t row_idx)
|
|
44
44
|
{
|
|
45
45
|
float fval = duckdb_value_float(result, col_idx, row_idx);
|
|
46
46
|
return DBL2NUM(fval);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
static VALUE to_ruby_obj_double(duckdb_result *result,
|
|
49
|
+
static VALUE to_ruby_obj_double(duckdb_result *result, idx_t col_idx, idx_t row_idx)
|
|
50
50
|
{
|
|
51
51
|
double dval = duckdb_value_double(result, col_idx, row_idx);
|
|
52
52
|
return DBL2NUM(dval);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
static VALUE to_ruby_obj(duckdb_result *result,
|
|
55
|
+
static VALUE to_ruby_obj(duckdb_result *result, idx_t col_idx, idx_t row_idx)
|
|
56
56
|
{
|
|
57
57
|
char *p;
|
|
58
58
|
VALUE obj = Qnil;
|
|
@@ -80,9 +80,9 @@ static VALUE to_ruby_obj(duckdb_result *result, index_t col_idx, index_t row_idx
|
|
|
80
80
|
return obj;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
static VALUE row_array(rubyDuckDBResult *ctx,
|
|
83
|
+
static VALUE row_array(rubyDuckDBResult *ctx, idx_t row_idx)
|
|
84
84
|
{
|
|
85
|
-
|
|
85
|
+
idx_t col_idx;
|
|
86
86
|
VALUE ary = rb_ary_new2(ctx->result.column_count);
|
|
87
87
|
for(col_idx = 0; col_idx < ctx->result.column_count; col_idx++) {
|
|
88
88
|
rb_ary_store(ary, col_idx, to_ruby_obj(&(ctx->result), col_idx, row_idx));
|
|
@@ -101,7 +101,7 @@ static VALUE duckdb_result_row_size(VALUE oDuckDBResult, VALUE args, VALUE obj)
|
|
|
101
101
|
static VALUE duckdb_result_each(VALUE oDuckDBResult)
|
|
102
102
|
{
|
|
103
103
|
rubyDuckDBResult *ctx;
|
|
104
|
-
|
|
104
|
+
idx_t row_idx = 0;
|
|
105
105
|
|
|
106
106
|
RETURN_SIZED_ENUMERATOR(oDuckDBResult, 0, 0, duckdb_result_row_size);
|
|
107
107
|
|
data/lib/duckdb.rb
CHANGED
data/lib/duckdb/connection.rb
CHANGED
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: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masaki Suketa
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-03-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|