sequel 5.37.0 → 5.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +12 -0
- data/doc/opening_databases.rdoc +5 -1
- data/doc/release_notes/5.38.0.txt +28 -0
- data/lib/sequel/adapters/jdbc.rb +13 -1
- data/lib/sequel/adapters/jdbc/mysql.rb +4 -4
- data/lib/sequel/adapters/shared/oracle.rb +1 -1
- data/lib/sequel/adapters/shared/postgres.rb +1 -1
- data/lib/sequel/database/connecting.rb +0 -1
- data/lib/sequel/database/misc.rb +14 -0
- data/lib/sequel/database/schema_methods.rb +1 -1
- data/lib/sequel/plugins/class_table_inheritance.rb +0 -5
- data/lib/sequel/plugins/dirty.rb +0 -1
- data/lib/sequel/plugins/single_table_inheritance.rb +5 -0
- data/lib/sequel/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1a5546546a02086c315afdb93e50fb2df1f12ee665f048cd36589bff6da6cd
|
4
|
+
data.tar.gz: f42f5a4ec65f1ed13de8f01f8091673688346be075fee60507adc13473e8528f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5838cb5c5a9b24ba5646967a88bc4d487b99e760f8112ab455f0fb19dcfbd63cf884e1032bc31055eaeb0d1a89ab7d61b0865f89bfa35587b13ef4060fc8348c
|
7
|
+
data.tar.gz: d113cbddf7ccc677e0b43dd919fccdf3461d3f2157374b37cf89cfb1ce5f3156d43aab2bfcd9498ff99500bcd5fcd350fb8424894141a02cd648be128f36d0fc
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 5.38.0 (2020-11-01)
|
2
|
+
|
3
|
+
* Do not add new Database instances to Sequel::DATABASES if the test connection fails (jeremyevans) (#1727)
|
4
|
+
|
5
|
+
* Support the newer com.mysql.cj.jdbc.Driver in the jdbc/mysql adapter (jeremyevans)
|
6
|
+
|
7
|
+
* Do not swallow disconnect errors in Database#create_or_replace_view or Database#create_table* on Oracle (jeremyevans)
|
8
|
+
|
9
|
+
* Only rescue non-disconnect Sequel::DatabaseErrors in Postgres::Database#server_version (jeremyevans) (#1724)
|
10
|
+
|
11
|
+
* Make the single_table_inheritance and prepared_statements plugins work if loaded into the same class (jeremyevans) (#1721)
|
12
|
+
|
1
13
|
=== 5.37.0 (2020-10-01)
|
2
14
|
|
3
15
|
* Recognize more unsigned decimal/float types in the schema dumper (akimd, jeremyevans) (#1720)
|
data/doc/opening_databases.rdoc
CHANGED
@@ -208,7 +208,7 @@ Example connection strings:
|
|
208
208
|
|
209
209
|
jdbc:sqlite::memory:
|
210
210
|
jdbc:postgresql://localhost/database?user=username
|
211
|
-
jdbc:mysql://localhost/test?user=root&password=root
|
211
|
+
jdbc:mysql://localhost/test?user=root&password=root&serverTimezone=UTC
|
212
212
|
jdbc:h2:mem:
|
213
213
|
jdbc:hsqldb:mem:mymemdb
|
214
214
|
jdbc:derby:memory:myDb;create=true
|
@@ -240,6 +240,10 @@ The following additional options are supported:
|
|
240
240
|
There are a few issues with specific jdbc driver gems:
|
241
241
|
|
242
242
|
jdbc-h2 :: jdbc-h2 versions greater than 1.3.175 have issues with ORDER BY not working correctly in some cases.
|
243
|
+
jdbc-mysql :: Depending on the configuration of the MySQL server, jdbc-mysql versions greater 8 may complain
|
244
|
+
about the server time zone being unrecognized. You can either use an older jdbc-mysql version,
|
245
|
+
or you can specify the +serverTimezone+ option in the connection string, as shown in the example
|
246
|
+
jdbc:mysql connection string above.
|
243
247
|
|
244
248
|
=== mysql
|
245
249
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* The jdbc/mysql adapter now supports the newer
|
4
|
+
com.mysql.cj.jdbc.Driver driver. The adapter will still attempt to
|
5
|
+
load the older com.mysql.jdbc.Driver if the com.mysql.cj.jdbc.Driver
|
6
|
+
is not found.
|
7
|
+
|
8
|
+
= Other Improvements
|
9
|
+
|
10
|
+
* When testing a connection after creating a new Database instance
|
11
|
+
raises an exception, the Database instance is removed from
|
12
|
+
Sequel::DATABASES.
|
13
|
+
|
14
|
+
* The single_table_inheritance and prepared_statements plugins now
|
15
|
+
work correctly if loaded into the same class.
|
16
|
+
|
17
|
+
* Database connect and disconnect errors are no longer swallowed when
|
18
|
+
calling Database#create_or_replace_view, Database#server_version
|
19
|
+
on PostgreSQL, or Database#create_table* on Oracle.
|
20
|
+
|
21
|
+
= Backwards Compatibility
|
22
|
+
|
23
|
+
* Previously, instantiating a new Database instance directly using
|
24
|
+
Sequel::Database.new did not test the connection by default. That
|
25
|
+
was instead handled by Sequel::Database.connect. The test
|
26
|
+
connection now happens inside Database#initialize. This should only
|
27
|
+
affect backwards compatibility for code that is calling
|
28
|
+
Sequel::Database.new directly.
|
data/lib/sequel/adapters/jdbc.rb
CHANGED
@@ -51,7 +51,19 @@ module Sequel
|
|
51
51
|
# Raise a Sequel::AdapterNotFound if evaluating the class name raises a NameError.
|
52
52
|
def self.load_driver(drv, gem=nil)
|
53
53
|
load_gem(gem) if gem
|
54
|
-
|
54
|
+
if drv.is_a?(String)
|
55
|
+
eval drv
|
56
|
+
else
|
57
|
+
*try, last = drv
|
58
|
+
try.each do |try_drv|
|
59
|
+
begin
|
60
|
+
return eval(try_drv)
|
61
|
+
rescue NameError
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
eval last
|
66
|
+
end
|
55
67
|
rescue NameError
|
56
68
|
raise Sequel::AdapterNotFound, "#{drv} not loaded#{", try installing jdbc-#{gem.to_s.downcase} gem" if gem}"
|
57
69
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('com.mysql.jdbc.Driver', :MySQL)
|
4
|
-
require_relative '../shared/mysql'
|
5
|
-
|
6
3
|
module Sequel
|
7
4
|
module JDBC
|
5
|
+
driver = Sequel::JDBC.load_driver(%w'com.mysql.cj.jdbc.Driver com.mysql.jdbc.Driver', :MySQL)
|
6
|
+
require_relative '../shared/mysql'
|
7
|
+
|
8
8
|
Sequel.synchronize do
|
9
9
|
DATABASE_SETUP[:mysql] = proc do |db|
|
10
10
|
db.extend(Sequel::JDBC::MySQL::DatabaseMethods)
|
11
11
|
db.extend_datasets Sequel::MySQL::DatasetMethods
|
12
|
-
|
12
|
+
driver
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -184,7 +184,7 @@ module Sequel
|
|
184
184
|
|
185
185
|
def create_table_from_generator(name, generator, options)
|
186
186
|
drop_statement, create_statements = create_table_sql_list(name, generator, options)
|
187
|
-
|
187
|
+
swallow_database_error{execute_ddl(drop_statement)} if drop_statement
|
188
188
|
create_statements.each{|sql| execute_ddl(sql)}
|
189
189
|
end
|
190
190
|
|
@@ -781,7 +781,7 @@ module Sequel
|
|
781
781
|
return @server_version if @server_version
|
782
782
|
ds = dataset
|
783
783
|
ds = ds.server(server) if server
|
784
|
-
@server_version
|
784
|
+
@server_version = swallow_database_error{ds.with_sql("SELECT CAST(current_setting('server_version_num') AS integer) AS v").single_value} || 0
|
785
785
|
end
|
786
786
|
|
787
787
|
# PostgreSQL supports CREATE TABLE IF NOT EXISTS on 9.1+
|
data/lib/sequel/database/misc.rb
CHANGED
@@ -166,6 +166,7 @@ module Sequel
|
|
166
166
|
end
|
167
167
|
|
168
168
|
initialize_load_extensions(:extensions)
|
169
|
+
test_connection if typecast_value_boolean(@opts.fetch(:test, true)) && respond_to?(:connect, true)
|
169
170
|
rescue
|
170
171
|
Sequel.synchronize{::Sequel::DATABASES.delete(self)} if keep_reference
|
171
172
|
raise
|
@@ -446,6 +447,19 @@ module Sequel
|
|
446
447
|
end
|
447
448
|
end
|
448
449
|
|
450
|
+
# Swallow database errors, unless they are connect/disconnect errors.
|
451
|
+
def swallow_database_error
|
452
|
+
yield
|
453
|
+
rescue Sequel::DatabaseDisconnectError, DatabaseConnectionError
|
454
|
+
# Always raise disconnect errors
|
455
|
+
raise
|
456
|
+
rescue Sequel::DatabaseError
|
457
|
+
# Don't raise other database errors.
|
458
|
+
nil
|
459
|
+
# else
|
460
|
+
# Don't rescue other exceptions, they will be raised normally.
|
461
|
+
end
|
462
|
+
|
449
463
|
# Typecast the value to an SQL::Blob
|
450
464
|
def typecast_value_blob(value)
|
451
465
|
value.is_a?(Sequel::SQL::Blob) ? value : Sequel::SQL::Blob.new(value)
|
data/lib/sequel/plugins/dirty.rb
CHANGED
@@ -187,7 +187,6 @@ module Sequel
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
-
# Manually specify that a column will change. This should only be used
|
191
190
|
# Manually specify that a column will change. This should only be used
|
192
191
|
# if you plan to modify a column value in place, which is not recommended.
|
193
192
|
#
|
data/lib/sequel/version.rb
CHANGED
@@ -6,7 +6,7 @@ module Sequel
|
|
6
6
|
|
7
7
|
# The minor version of Sequel. Bumped for every non-patch level
|
8
8
|
# release, generally around once a month.
|
9
|
-
MINOR =
|
9
|
+
MINOR = 38
|
10
10
|
|
11
11
|
# The tiny version of Sequel. Usually 0, only bumped for bugfix
|
12
12
|
# releases that fix regressions from previous versions.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.38.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -185,6 +185,7 @@ extra_rdoc_files:
|
|
185
185
|
- doc/release_notes/5.35.0.txt
|
186
186
|
- doc/release_notes/5.36.0.txt
|
187
187
|
- doc/release_notes/5.37.0.txt
|
188
|
+
- doc/release_notes/5.38.0.txt
|
188
189
|
files:
|
189
190
|
- CHANGELOG
|
190
191
|
- MIT-LICENSE
|
@@ -243,6 +244,7 @@ files:
|
|
243
244
|
- doc/release_notes/5.35.0.txt
|
244
245
|
- doc/release_notes/5.36.0.txt
|
245
246
|
- doc/release_notes/5.37.0.txt
|
247
|
+
- doc/release_notes/5.38.0.txt
|
246
248
|
- doc/release_notes/5.4.0.txt
|
247
249
|
- doc/release_notes/5.5.0.txt
|
248
250
|
- doc/release_notes/5.6.0.txt
|
@@ -549,7 +551,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
549
551
|
- !ruby/object:Gem::Version
|
550
552
|
version: '0'
|
551
553
|
requirements: []
|
552
|
-
rubygems_version: 3.1.
|
554
|
+
rubygems_version: 3.1.4
|
553
555
|
signing_key:
|
554
556
|
specification_version: 4
|
555
557
|
summary: The Database Toolkit for Ruby
|