duckdb 0.2.9.0 → 0.3.1.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: af998f52f46c0ef8f51501333cbaf39d720daaa389eb618d7d7ad79627d70ad9
4
- data.tar.gz: 8e1c5323fa2f917c9ab6050a0350e5e25b646559492501f636af026b79cb20f8
3
+ metadata.gz: ba5fa57fc1eaf1a2b0bb6ffa7379b8982d3858d17075c83b949af79331322a1e
4
+ data.tar.gz: cbe87ed1de6de024e9941e063102e7bf31a5407945d99180121a38fde703a8d4
5
5
  SHA512:
6
- metadata.gz: 14809adeffb7bc79f2102e29f89a6fe6ea276ab38eaeabed9f3c18a023566c3bbad06c1ab31e55499e77d3f0f9ced186d618c24639b8c16ceff1ee61304f9f67
7
- data.tar.gz: 15d164af6af9d985765d7b9fa87dcf7f9cf89fb2d691c9d44ea2d2bb72341a77213647cb08bcacc66094eb1622d250fe203f41a9529866af9f358518800f7183
6
+ metadata.gz: 52d8cff8db75e7e2d7f86632573fda6d1fe021e7ff38524edf9307e2d3c4720541daab609caee24307c3a8b6a0fa40d6b1cca4151d1edbb8b17f3c7f770bb7d3
7
+ data.tar.gz: 371925fa099235c382cdd370f0d43d346f40b9dc45332931956f953ab742b0a55ec7afa52f73aa942695fe30b1df78722e7afadb1de66a6250381fdf0ed990f8
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  matrix:
10
10
  ruby: ['2.6.8', '2.7.4', '3.0.2', 'head']
11
- duckdb: ['0.2.8', '0.2.9']
11
+ duckdb: ['0.3.0', '0.3.1']
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v2
@@ -18,32 +18,17 @@ jobs:
18
18
  with:
19
19
  ruby-version: ${{ matrix.ruby }}
20
20
 
21
- - name: duckdb cache
22
- id: duckdb-cache
23
- uses: actions/cache@v2
24
- with:
25
- path: /usr/local/Cellar/duckdb@${{ matrix.duckdb }}
26
- key: ${{ runner.os }}-duckdb-v${{ matrix.duckdb }}
27
-
28
- - name: Install duckdb v${{ matrix.duckdb }} by brew
21
+ - name: download duckdb binary for MacOS 64bit
29
22
  env:
30
23
  DUCKDB_VERSION: ${{ matrix.duckdb }}
31
- if: steps.duckdb-cache.outputs.cache-hit != 'true'
32
24
  run: |
33
- brew tap-new duckdb/taps
34
- brew extract duckdb duckdb/taps --version $DUCKDB_VERSION
35
- brew install duckdb/taps/duckdb@$DUCKDB_VERSION
25
+ curl -OL https://github.com/duckdb/duckdb/releases/download/v${DUCKDB_VERSION}/libduckdb-osx-amd64.zip
36
26
 
37
- - name: setup duckdb v${{ matrix.duckdb }} headers and libraries
38
- env:
39
- DUCKDB_VERSION: ${{ matrix.duckdb }}
27
+ - name: extract zip file
40
28
  run: |
41
- if [ ! -L /usr/local/include/duckdb.h ]; then
42
- header=`find /usr/local/Cellar/duckdb@$DUCKDB_VERSION -name "duckdb.h"`
43
- lib=`find /usr/local/Cellar/duckdb@$DUCKDB_VERSION -name "libduckdb.dylib"`
44
- ln -s $header /usr/local/include/duckdb.h
45
- ln -s $lib /usr/local/lib/libduckdb.dylib
46
- fi
29
+ unzip libduckdb-osx-amd64.zip
30
+ cp duckdb.h /usr/local/include
31
+ cp libduckdb.dylib /usr/local/lib
47
32
 
48
33
  - name: Build and test with Rake with Ruby ${{ matrix.ruby }}
49
34
  run: |
@@ -9,7 +9,7 @@ jobs:
9
9
  strategy:
10
10
  matrix:
11
11
  ruby: ['2.6.8', '2.7.4', '3.0.2', 'head']
12
- duckdb: ['0.2.8', '0.2.9']
12
+ duckdb: ['0.3.0', '0.3.1']
13
13
 
14
14
  steps:
15
15
  - uses: actions/checkout@v2
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  matrix:
10
10
  ruby: ['2.6.8', '2.7.4', '3.0.2', 'head']
11
- duckdb: ['0.2.8', '0.2.9']
11
+ duckdb: ['0.3.0', '0.3.1']
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v2
@@ -36,8 +36,6 @@ jobs:
36
36
  run: |
37
37
  cp duckdb.dll C:/Windows/System32/
38
38
 
39
- # FIXME: rake test fails with LoadError
40
- # C:/hostedtoolcache/windows/Ruby/2.7.3/x64/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': 126: The specified module could not be found. - D:/a/ruby-duckdb/ruby-duckdb/lib/duckdb/duckdb_native.so (LoadError)`
41
39
  - name: rake test
42
40
  run: |
43
41
  rake test
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # ChangeLog
2
2
 
3
+ # 0.3.1.0
4
+
5
+ - bump duckdb to 0.3.1 in CI.
6
+ - bump duckdb to 0.3.0 in CI.
7
+ - append_time, append_date, append_timestamp of DuckDB::Appender accept argument
8
+ having to_str to convert time string.
9
+
3
10
  # 0.2.9.0
4
11
 
5
12
  - add DuckDB::Appender#append
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- duckdb (0.2.9.0)
4
+ duckdb (0.3.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,22 +2,25 @@
2
2
 
3
3
  VALUE cDuckDBConnection;
4
4
 
5
- static void deallocate(void *ctx)
6
- {
5
+ static void deallocate(void *ctx);
6
+ static VALUE allocate(VALUE klass);
7
+ static VALUE duckdb_connection_disconnect(VALUE self);
8
+ static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase);
9
+ static VALUE duckdb_connection_query_sql(VALUE self, VALUE str);
10
+
11
+ static void deallocate(void *ctx) {
7
12
  rubyDuckDBConnection *p = (rubyDuckDBConnection *)ctx;
8
13
 
9
14
  duckdb_disconnect(&(p->con));
10
15
  xfree(p);
11
16
  }
12
17
 
13
- static VALUE allocate(VALUE klass)
14
- {
18
+ static VALUE allocate(VALUE klass) {
15
19
  rubyDuckDBConnection *ctx = xcalloc((size_t)1, sizeof(rubyDuckDBConnection));
16
20
  return Data_Wrap_Struct(klass, NULL, deallocate, ctx);
17
21
  }
18
22
 
19
- VALUE create_connection(VALUE oDuckDBDatabase)
20
- {
23
+ VALUE create_connection(VALUE oDuckDBDatabase) {
21
24
  rubyDuckDB *ctxdb;
22
25
  rubyDuckDBConnection *ctxcon;
23
26
  VALUE obj;
@@ -35,8 +38,7 @@ VALUE create_connection(VALUE oDuckDBDatabase)
35
38
  return obj;
36
39
  }
37
40
 
38
- static VALUE duckdb_connection_disconnect(VALUE self)
39
- {
41
+ static VALUE duckdb_connection_disconnect(VALUE self) {
40
42
  rubyDuckDBConnection *ctx;
41
43
 
42
44
  Data_Get_Struct(self, rubyDuckDBConnection, ctx);
@@ -45,8 +47,7 @@ static VALUE duckdb_connection_disconnect(VALUE self)
45
47
  return self;
46
48
  }
47
49
 
48
- static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase)
49
- {
50
+ static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase) {
50
51
  rubyDuckDBConnection *ctx;
51
52
  rubyDuckDB *ctxdb;
52
53
 
@@ -63,8 +64,7 @@ static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase)
63
64
  return self;
64
65
  }
65
66
 
66
- static VALUE duckdb_connection_query_sql(VALUE self, VALUE str)
67
- {
67
+ static VALUE duckdb_connection_query_sql(VALUE self, VALUE str) {
68
68
  rubyDuckDBConnection *ctx;
69
69
  rubyDuckDBResult *ctxr;
70
70
 
@@ -7,28 +7,26 @@ static void deallocate(void * ctx);
7
7
  static VALUE allocate(VALUE klass);
8
8
  static VALUE duckdb_database_s_open(int argc, VALUE *argv, VALUE cDuckDBDatabase);
9
9
  static VALUE duckdb_database_s_open_ext(int argc, VALUE *argv, VALUE cDuckDBDatabase);
10
+ static VALUE duckdb_database_connect(VALUE self);
11
+ static VALUE duckdb_database_close(VALUE self);
10
12
 
11
- static void close_database(rubyDuckDB *p)
12
- {
13
+ static void close_database(rubyDuckDB *p) {
13
14
  duckdb_close(&(p->db));
14
15
  }
15
16
 
16
- static void deallocate(void * ctx)
17
- {
17
+ static void deallocate(void * ctx) {
18
18
  rubyDuckDB *p = (rubyDuckDB *)ctx;
19
19
 
20
20
  close_database(p);
21
21
  xfree(p);
22
22
  }
23
23
 
24
- static VALUE allocate(VALUE klass)
25
- {
24
+ static VALUE allocate(VALUE klass) {
26
25
  rubyDuckDB *ctx = xcalloc((size_t)1, sizeof(rubyDuckDB));
27
26
  return Data_Wrap_Struct(klass, NULL, deallocate, ctx);
28
27
  }
29
28
 
30
- static VALUE duckdb_database_s_open(int argc, VALUE *argv, VALUE cDuckDBDatabase)
31
- {
29
+ static VALUE duckdb_database_s_open(int argc, VALUE *argv, VALUE cDuckDBDatabase) {
32
30
  rubyDuckDB *ctx;
33
31
  VALUE obj;
34
32
 
@@ -50,8 +48,7 @@ static VALUE duckdb_database_s_open(int argc, VALUE *argv, VALUE cDuckDBDatabase
50
48
  }
51
49
 
52
50
  #ifdef HAVE_DUCKDB_OPEN_EXT
53
- static VALUE duckdb_database_s_open_ext(int argc, VALUE *argv, VALUE cDuckDBDatabase)
54
- {
51
+ static VALUE duckdb_database_s_open_ext(int argc, VALUE *argv, VALUE cDuckDBDatabase) {
55
52
  rubyDuckDB *ctx;
56
53
  VALUE obj;
57
54
  rubyDuckDBConfig *ctx_config;
@@ -86,8 +83,7 @@ static VALUE duckdb_database_s_open_ext(int argc, VALUE *argv, VALUE cDuckDBData
86
83
  }
87
84
  #endif /* HAVE_DUCKDB_OPEN_EXT */
88
85
 
89
- static VALUE duckdb_database_connect(VALUE self)
90
- {
86
+ static VALUE duckdb_database_connect(VALUE self) {
91
87
  return create_connection(self);
92
88
  }
93
89
 
@@ -97,16 +93,14 @@ static VALUE duckdb_database_connect(VALUE self)
97
93
  *
98
94
  * closes DuckDB database.
99
95
  */
100
- static VALUE duckdb_database_close(VALUE self)
101
- {
96
+ static VALUE duckdb_database_close(VALUE self) {
102
97
  rubyDuckDB *ctx;
103
98
  Data_Get_Struct(self, rubyDuckDB, ctx);
104
99
  close_database(ctx);
105
100
  return self;
106
101
  }
107
102
 
108
- void init_duckdb_database(void)
109
- {
103
+ void init_duckdb_database(void) {
110
104
  cDuckDBDatabase = rb_define_class_under(mDuckDB, "Database", rb_cObject);
111
105
  rb_define_alloc_func(cDuckDBDatabase, allocate);
112
106
  rb_define_singleton_method(cDuckDBDatabase, "_open", duckdb_database_s_open, -1);
@@ -63,18 +63,16 @@ module DuckDB
63
63
  # appender.flush
64
64
  #
65
65
  def append_date(value)
66
- case value
67
- when Date, Time
68
- date = value
69
- when String
70
- begin
71
- date = Date.parse(value)
72
- rescue
73
- raise(ArgumentError, "Cannot parse argument `#{value}` to Date.")
74
- end
75
- else
76
- raise(ArgumentError, "Argument `#{value}` must be Date, Time or String.")
77
- end
66
+ date = case value
67
+ when Date, Time
68
+ value
69
+ else
70
+ begin
71
+ Date.parse(value)
72
+ rescue
73
+ raise(ArgumentError, "Cannot parse argument `#{value}` to Date.")
74
+ end
75
+ end
78
76
 
79
77
  _append_date(date.year, date.month, date.day)
80
78
  end
@@ -95,18 +93,16 @@ module DuckDB
95
93
  # appender.flush
96
94
  #
97
95
  def append_time(value)
98
- case value
99
- when Time
100
- time = value
101
- when String
102
- begin
103
- time = Time.parse(value)
104
- rescue
105
- raise(ArgumentError, "Cannot parse argument `#{value}` to Time.")
106
- end
107
- else
108
- raise(ArgumentError, "Argument `#{value}` must be Time or String.")
109
- end
96
+ time = case value
97
+ when Time
98
+ value
99
+ else
100
+ begin
101
+ Time.parse(value)
102
+ rescue
103
+ raise(ArgumentError, "Cannot parse argument `#{value}` to Time.")
104
+ end
105
+ end
110
106
 
111
107
  _append_time(time.hour, time.min, time.sec, time.usec)
112
108
  end
@@ -128,20 +124,19 @@ module DuckDB
128
124
  # appender.flush
129
125
  #
130
126
  def append_timestamp(value)
131
- case value
132
- when Time
133
- time = value
134
- when Date
135
- time = value.to_time
136
- when String
137
- begin
138
- time = Time.parse(value)
139
- rescue
140
- raise(ArgumentError, "Cannot parse argument `#{value.class} #{value}` to Time.")
141
- end
142
- else
143
- raise(ArgumentError, "Argument `#{value.class} #{value}` must be Time or Date or String.")
144
- end
127
+ time = case value
128
+ when Time
129
+ value
130
+ when Date
131
+ value.to_time
132
+ else
133
+ begin
134
+ Time.parse(value)
135
+ rescue
136
+ raise(ArgumentError, "Cannot parse argument `#{value}` to Time or Date.")
137
+ end
138
+ end
139
+
145
140
  _append_timestamp(time.year, time.month, time.day, time.hour, time.min, time.sec, time.nsec / 1000)
146
141
  end
147
142
 
@@ -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.2.9.0'.freeze
4
+ VERSION = '0.3.1.0'.freeze
5
5
  end
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.2.9.0
4
+ version: 0.3.1.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: 2021-10-24 00:00:00.000000000 Z
11
+ date: 2021-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler