sequel_pg 1.18.1 → 1.19.0
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 +8 -0
- data/ext/sequel_pg/extconf.rb +1 -0
- data/ext/sequel_pg/sequel_pg.c +34 -2
- data/lib/sequel_pg/sequel_pg.rb +3 -3
- 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: 8ce323f82d06024c56ba214fa69c6e63e243c29370b530eda09865d9eebd8ad1
|
|
4
|
+
data.tar.gz: 2719034e2a533d328ffe3a2e73834c0074c5f9efc6053d4865c58e136eee5554
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4dcf359f0300e00c3249a3caaea255d18dff3770a1e6bfb51e6ac96dee7809a31680f093fb476457fea4b67ccf457355d5295b369c725d2b142773bd21171aa9
|
|
7
|
+
data.tar.gz: 32275e2f6cbc631f513606b053d8c6660d497a76cc926dd8af7314f2ebad0c17f5b72db1a02d0267f4e265070a3874921e2a4b3a8bfe9f40467728e5a62a25d9
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
=== 1.19.0 (2026-03-06)
|
|
2
|
+
|
|
3
|
+
* Cancel the query if an exception is raised while streaming query results (jtmkrueger, jeremyevans) (#66)
|
|
4
|
+
|
|
5
|
+
=== 1.18.2 (2025-12-18)
|
|
6
|
+
|
|
7
|
+
* Avoid bogus warnings about the implicit block parameter in Ruby 3.3 (jeremyevans) (#64)
|
|
8
|
+
|
|
1
9
|
=== 1.18.1 (2025-12-16)
|
|
2
10
|
|
|
3
11
|
* Fix truncated results for map/select_map/select_order_map/as_hash/to_hash_groups/select_hash/select_hash_groups/as_set/select_set for datasets using use_cursor (jeremyevans) (#62)
|
data/ext/sequel_pg/extconf.rb
CHANGED
|
@@ -10,6 +10,7 @@ if (have_library('pq') || have_library('libpq') || have_library('ms/libpq')) &&
|
|
|
10
10
|
have_func 'rb_hash_new_capa'
|
|
11
11
|
have_func 'rb_set_new_capa'
|
|
12
12
|
have_func 'PQsetSingleRowMode'
|
|
13
|
+
have_func 'PQcancelCreate'
|
|
13
14
|
have_func 'timegm'
|
|
14
15
|
create_makefile("sequel_pg")
|
|
15
16
|
else
|
data/ext/sequel_pg/sequel_pg.c
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#define SEQUEL_PG_VERSION_INTEGER
|
|
1
|
+
#define SEQUEL_PG_VERSION_INTEGER 11900
|
|
2
2
|
|
|
3
3
|
#include <string.h>
|
|
4
4
|
#include <stdio.h>
|
|
@@ -2004,6 +2004,38 @@ static VALUE spg__flush_results(VALUE rconn) {
|
|
|
2004
2004
|
VALUE error = 0;
|
|
2005
2005
|
conn = pg_get_pgconn(rconn);
|
|
2006
2006
|
|
|
2007
|
+
/* Only cancel if an exception is being unwound. During normal
|
|
2008
|
+
* completion, the query has already finished and there are no
|
|
2009
|
+
* results to drain, so canceling is unnecessary. */
|
|
2010
|
+
if (rb_errinfo() != Qnil) {
|
|
2011
|
+
#ifdef HAVE_PQCANCELCREATE
|
|
2012
|
+
PGcancelConn *cancel = PQcancelCreate(conn);
|
|
2013
|
+
if (cancel) {
|
|
2014
|
+
int cancel_ok = PQcancelBlocking(cancel);
|
|
2015
|
+
PQcancelFinish(cancel);
|
|
2016
|
+
#else
|
|
2017
|
+
PGcancel *cancel = PQgetCancel(conn);
|
|
2018
|
+
if (cancel) {
|
|
2019
|
+
char errbuf[256];
|
|
2020
|
+
int cancel_ok = PQcancel(cancel, errbuf, sizeof(errbuf));
|
|
2021
|
+
PQfreeCancel(cancel);
|
|
2022
|
+
#endif
|
|
2023
|
+
|
|
2024
|
+
if (cancel_ok) {
|
|
2025
|
+
/* Cancel succeeded. Drain remaining results without raising.
|
|
2026
|
+
* The cancel produces an expected error result ("canceling
|
|
2027
|
+
* statement due to user request"). The original exception
|
|
2028
|
+
* will propagate via rb_ensure. */
|
|
2029
|
+
while ((res = PQgetResult(conn)) != NULL) {
|
|
2030
|
+
PQclear(res);
|
|
2031
|
+
}
|
|
2032
|
+
return rconn;
|
|
2033
|
+
}
|
|
2034
|
+
/* Cancel failed. Fallthrough to the normal drain loop which
|
|
2035
|
+
* will check for and report any real errors. */
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2007
2039
|
while ((res = PQgetResult(conn)) != NULL) {
|
|
2008
2040
|
if (!error) {
|
|
2009
2041
|
switch (PQresultStatus(res))
|
|
@@ -2019,7 +2051,7 @@ static VALUE spg__flush_results(VALUE rconn) {
|
|
|
2019
2051
|
}
|
|
2020
2052
|
PQclear(res);
|
|
2021
2053
|
}
|
|
2022
|
-
|
|
2054
|
+
|
|
2023
2055
|
if (error) {
|
|
2024
2056
|
VALUE exception = rb_exc_new3(spg_PGError, error);
|
|
2025
2057
|
rb_iv_set(exception, "@connection", rconn);
|
data/lib/sequel_pg/sequel_pg.rb
CHANGED
|
@@ -27,7 +27,7 @@ class Sequel::Postgres::Dataset
|
|
|
27
27
|
if RUBY_VERSION > '4'
|
|
28
28
|
def as_set(column)
|
|
29
29
|
return super unless allow_sequel_pg_optimization?
|
|
30
|
-
clone(:_sequel_pg_type=>:map_set, :_sequel_pg_value=>column).fetch_rows(sql){return
|
|
30
|
+
clone(:_sequel_pg_type=>:map_set, :_sequel_pg_value=>column).fetch_rows(sql){|s| return s}
|
|
31
31
|
Set.new
|
|
32
32
|
end
|
|
33
33
|
# :nocov:
|
|
@@ -142,14 +142,14 @@ class Sequel::Postgres::Dataset
|
|
|
142
142
|
# Always use optimized version
|
|
143
143
|
def _select_set_multiple(ret_cols)
|
|
144
144
|
return super unless allow_sequel_pg_optimization?
|
|
145
|
-
clone(:_sequel_pg_type=>:array_set).fetch_rows(sql){return
|
|
145
|
+
clone(:_sequel_pg_type=>:array_set).fetch_rows(sql){|s| return s}
|
|
146
146
|
Set.new
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
# Always use optimized version
|
|
150
150
|
def _select_set_single
|
|
151
151
|
return super unless allow_sequel_pg_optimization?
|
|
152
|
-
clone(:_sequel_pg_type=>:first_set).fetch_rows(sql){return
|
|
152
|
+
clone(:_sequel_pg_type=>:first_set).fetch_rows(sql){|s| return s}
|
|
153
153
|
Set.new
|
|
154
154
|
end
|
|
155
155
|
# :nocov:
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sequel_pg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Evans
|
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
101
|
version: '0'
|
|
102
102
|
requirements: []
|
|
103
|
-
rubygems_version:
|
|
103
|
+
rubygems_version: 4.0.3
|
|
104
104
|
specification_version: 4
|
|
105
105
|
summary: Faster SELECTs when using Sequel with pg
|
|
106
106
|
test_files: []
|