duckdb 1.5.6.0 → 1.5.6.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/CHANGELOG.md +3 -0
- data/ext/duckdb/connection.c +11 -10
- data/ext/duckdb/connection.h +1 -0
- data/ext/duckdb/extracted_statements.c +9 -4
- data/lib/duckdb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74ccac3599175a19bbc80ef6e9ad8e9aae62152d96b78dd6357623f647b62ff2
|
|
4
|
+
data.tar.gz: 9302451535c8b0b32f561a7deb45bd0f1800a77889592308c5e94714abd5fa33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29981f3882568513062d0a59e04e434dd8b557635c70b51fb2bfc017a077bf7076a10b384b676a7c32e7bf0d6d24420622e4e04164fced341b9165fe11cce062
|
|
7
|
+
data.tar.gz: e16e3171bd0c0f8f0e26f2c48e6f3a4d73fb1c93b00a01a4ae5d790a66ea0a198aa722d91790eb95e3b4fb1f66e167e3a69cf0377effa39138e801d7eb9eac16
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
# Unreleased
|
|
6
6
|
|
|
7
|
+
# 1.5.6.1 - 2026-10-17
|
|
8
|
+
- fix `DuckDB::ExtractedStatements.new`, `Connection#query` and `Connection#extract` raising `Failed to extract statements(Database connection closed?).` for SQL that contains no statements, such as only a comment, whitespace or `;` (issue #1490). `ExtractedStatements#size` is now `0`, `Connection#query` returns `nil` and `Connection#extract` returns `[]`. Calling `ExtractedStatements.new` on a closed connection now raises `Database connection closed`.
|
|
9
|
+
|
|
7
10
|
# 1.5.6.0 - 2026-10-11
|
|
8
11
|
- bump up DuckDB 1.5.6 on CI.
|
|
9
12
|
|
data/ext/duckdb/connection.c
CHANGED
|
@@ -75,6 +75,15 @@ rubyDuckDBConnection *rbduckdb_get_struct_connection(VALUE obj) {
|
|
|
75
75
|
return ctx;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
rubyDuckDBConnection *rbduckdb_get_open_struct_connection(VALUE obj) {
|
|
79
|
+
rubyDuckDBConnection *ctx = rbduckdb_get_struct_connection(obj);
|
|
80
|
+
|
|
81
|
+
if (!(ctx->con)) {
|
|
82
|
+
rb_raise(eDuckDBError, "Database connection closed");
|
|
83
|
+
}
|
|
84
|
+
return ctx;
|
|
85
|
+
}
|
|
86
|
+
|
|
78
87
|
VALUE rbduckdb_create_connection(VALUE oDuckDBDatabase) {
|
|
79
88
|
rubyDuckDB *ctxdb;
|
|
80
89
|
rubyDuckDBConnection *ctxcon;
|
|
@@ -203,13 +212,9 @@ static VALUE connection__query_sql(VALUE self, VALUE str) {
|
|
|
203
212
|
|
|
204
213
|
VALUE result = rbduckdb_create_result();
|
|
205
214
|
|
|
206
|
-
|
|
215
|
+
ctx = rbduckdb_get_open_struct_connection(self);
|
|
207
216
|
ctxr = rbduckdb_get_struct_result(result);
|
|
208
217
|
|
|
209
|
-
if (!(ctx->con)) {
|
|
210
|
-
rb_raise(eDuckDBError, "Database connection closed");
|
|
211
|
-
}
|
|
212
|
-
|
|
213
218
|
/* Extract C string before releasing GVL (StringValueCStr is a Ruby operation) */
|
|
214
219
|
const char *sql = StringValueCStr(str);
|
|
215
220
|
|
|
@@ -235,11 +240,7 @@ static VALUE connection__get_table_names(VALUE self, VALUE query, VALUE qualifie
|
|
|
235
240
|
rubyDuckDBConnection *ctx;
|
|
236
241
|
duckdb_value table_names;
|
|
237
242
|
|
|
238
|
-
ctx =
|
|
239
|
-
|
|
240
|
-
if (!(ctx->con)) {
|
|
241
|
-
rb_raise(eDuckDBError, "Database connection closed");
|
|
242
|
-
}
|
|
243
|
+
ctx = rbduckdb_get_open_struct_connection(self);
|
|
243
244
|
|
|
244
245
|
table_names = duckdb_get_table_names(ctx->con, StringValueCStr(query), RTEST(qualified));
|
|
245
246
|
|
data/ext/duckdb/connection.h
CHANGED
|
@@ -10,6 +10,7 @@ struct _rubyDuckDBConnection {
|
|
|
10
10
|
typedef struct _rubyDuckDBConnection rubyDuckDBConnection;
|
|
11
11
|
|
|
12
12
|
rubyDuckDBConnection *rbduckdb_get_struct_connection(VALUE obj);
|
|
13
|
+
rubyDuckDBConnection *rbduckdb_get_open_struct_connection(VALUE obj);
|
|
13
14
|
void rbduckdb_init_connection(void);
|
|
14
15
|
VALUE rbduckdb_create_connection(VALUE oDuckDBDatabase);
|
|
15
16
|
|
|
@@ -50,14 +50,19 @@ static VALUE extracted_statements__initialize(VALUE self, VALUE con, VALUE query
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
pquery = StringValuePtr(query);
|
|
53
|
-
pcon =
|
|
53
|
+
pcon = rbduckdb_get_open_struct_connection(con);
|
|
54
54
|
TypedData_Get_Struct(self, rubyDuckDBExtractedStatements, &extract_statements_data_type, ctx);
|
|
55
55
|
|
|
56
56
|
ctx->num_statements = duckdb_extract_statements(pcon->con, pquery, &(ctx->extracted_statements));
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
/*
|
|
59
|
+
* duckdb_extract_statements returns 0 both on a parse error and when the
|
|
60
|
+
* query contains no statements (e.g. only a comment). Only the former
|
|
61
|
+
* sets an error message.
|
|
62
|
+
*/
|
|
63
|
+
error = duckdb_extract_statements_error(ctx->extracted_statements);
|
|
64
|
+
if (error) {
|
|
65
|
+
rb_raise(eDuckDBError, "%s", error);
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
return self;
|
data/lib/duckdb/version.rb
CHANGED