sequel 5.33.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 +88 -0
- data/README.rdoc +1 -1
- data/doc/association_basics.rdoc +7 -2
- data/doc/dataset_filtering.rdoc +2 -2
- data/doc/model_plugins.rdoc +1 -1
- data/doc/opening_databases.rdoc +5 -1
- data/doc/release_notes/5.34.0.txt +40 -0
- data/doc/release_notes/5.35.0.txt +56 -0
- data/doc/release_notes/5.36.0.txt +60 -0
- data/doc/release_notes/5.37.0.txt +30 -0
- data/doc/release_notes/5.38.0.txt +28 -0
- data/doc/transactions.rdoc +0 -8
- data/doc/validations.rdoc +1 -1
- data/lib/sequel/adapters/jdbc.rb +13 -1
- data/lib/sequel/adapters/jdbc/mysql.rb +4 -4
- data/lib/sequel/adapters/odbc.rb +4 -6
- data/lib/sequel/adapters/oracle.rb +2 -1
- data/lib/sequel/adapters/shared/mssql.rb +14 -4
- data/lib/sequel/adapters/shared/oracle.rb +13 -7
- data/lib/sequel/adapters/shared/postgres.rb +39 -1
- data/lib/sequel/adapters/shared/sqlite.rb +8 -2
- data/lib/sequel/adapters/tinytds.rb +1 -0
- data/lib/sequel/adapters/utils/mysql_mysql2.rb +1 -0
- data/lib/sequel/connection_pool/sharded_single.rb +4 -1
- data/lib/sequel/connection_pool/sharded_threaded.rb +10 -10
- data/lib/sequel/connection_pool/single.rb +1 -1
- data/lib/sequel/connection_pool/threaded.rb +1 -1
- data/lib/sequel/core.rb +5 -6
- data/lib/sequel/database/connecting.rb +1 -2
- data/lib/sequel/database/misc.rb +30 -10
- data/lib/sequel/database/query.rb +2 -0
- data/lib/sequel/database/schema_generator.rb +0 -1
- data/lib/sequel/database/schema_methods.rb +16 -17
- data/lib/sequel/database/transactions.rb +8 -5
- data/lib/sequel/dataset/actions.rb +10 -6
- data/lib/sequel/dataset/placeholder_literalizer.rb +3 -7
- data/lib/sequel/dataset/query.rb +5 -4
- data/lib/sequel/deprecated.rb +3 -1
- data/lib/sequel/exceptions.rb +2 -0
- data/lib/sequel/extensions/_pretty_table.rb +1 -2
- data/lib/sequel/extensions/columns_introspection.rb +1 -2
- data/lib/sequel/extensions/core_refinements.rb +2 -0
- data/lib/sequel/extensions/duplicate_columns_handler.rb +2 -0
- data/lib/sequel/extensions/migration.rb +8 -2
- data/lib/sequel/extensions/pg_array_ops.rb +4 -0
- data/lib/sequel/extensions/pg_enum.rb +2 -0
- data/lib/sequel/extensions/pg_extended_date_support.rb +1 -1
- data/lib/sequel/extensions/pg_hstore_ops.rb +2 -0
- data/lib/sequel/extensions/pg_inet.rb +2 -0
- data/lib/sequel/extensions/pg_json_ops.rb +46 -2
- data/lib/sequel/extensions/pg_range.rb +3 -7
- data/lib/sequel/extensions/pg_range_ops.rb +2 -0
- data/lib/sequel/extensions/pg_row.rb +0 -1
- data/lib/sequel/extensions/pg_row_ops.rb +24 -0
- data/lib/sequel/extensions/query.rb +1 -0
- data/lib/sequel/extensions/run_transaction_hooks.rb +1 -1
- data/lib/sequel/extensions/s.rb +2 -0
- data/lib/sequel/extensions/schema_dumper.rb +3 -3
- data/lib/sequel/extensions/symbol_aref_refinement.rb +2 -0
- data/lib/sequel/extensions/symbol_as_refinement.rb +2 -0
- data/lib/sequel/extensions/to_dot.rb +9 -3
- data/lib/sequel/model.rb +3 -1
- data/lib/sequel/model/associations.rb +36 -20
- data/lib/sequel/model/base.rb +13 -5
- data/lib/sequel/model/plugins.rb +3 -3
- data/lib/sequel/plugins/association_pks.rb +60 -18
- data/lib/sequel/plugins/association_proxies.rb +1 -0
- data/lib/sequel/plugins/blacklist_security.rb +1 -2
- data/lib/sequel/plugins/class_table_inheritance.rb +3 -8
- data/lib/sequel/plugins/csv_serializer.rb +2 -0
- data/lib/sequel/plugins/dirty.rb +44 -0
- data/lib/sequel/plugins/forbid_lazy_load.rb +2 -0
- data/lib/sequel/plugins/instance_specific_default.rb +113 -0
- data/lib/sequel/plugins/lazy_attributes.rb +1 -1
- data/lib/sequel/plugins/pg_array_associations.rb +2 -3
- data/lib/sequel/plugins/prepared_statements.rb +5 -11
- data/lib/sequel/plugins/prepared_statements_safe.rb +1 -3
- data/lib/sequel/plugins/rcte_tree.rb +10 -16
- data/lib/sequel/plugins/single_table_inheritance.rb +5 -0
- data/lib/sequel/plugins/string_stripper.rb +1 -1
- data/lib/sequel/plugins/validation_class_methods.rb +5 -1
- data/lib/sequel/version.rb +1 -1
- metadata +14 -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,91 @@
|
|
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
|
+
|
13
|
+
=== 5.37.0 (2020-10-01)
|
14
|
+
|
15
|
+
* Recognize more unsigned decimal/float types in the schema dumper (akimd, jeremyevans) (#1720)
|
16
|
+
|
17
|
+
* Add Postgres::PGRow::{Array,Hash}Row#op to the pg_row_ops extension if the pg_row extension is loaded (jeremyevans)
|
18
|
+
|
19
|
+
* Add Model#column_previously_was and #column_previously_changed? to the dirty plugin (jeremyevans)
|
20
|
+
|
21
|
+
* Raise Migrator::Error if attempting to migrate down to a version where there are necessary migration files missing (jeremyevans) (#1716)
|
22
|
+
|
23
|
+
=== 5.36.0 (2020-09-01)
|
24
|
+
|
25
|
+
* Handle passing keyword arguments through class methods defined via Plugins.def_dataset_method on Ruby 2.7+ (jeremyevans)
|
26
|
+
|
27
|
+
* Handle passing keyword arguments through when loading plugins on Ruby 2.7+ (jeremyevans)
|
28
|
+
|
29
|
+
* Handle passing keyword arguments through migrations when defining custom Database methods that accept keywords on Ruby 2.7+ (jeremyevans)
|
30
|
+
|
31
|
+
* Handle passing keyword arguments through Dataset#query when using the query extension on Ruby 2.7+ (jeremyevans)
|
32
|
+
|
33
|
+
* Handle passing keyword arguments through the association proxy when using the association_proxies plugin on Ruby 2.7+ (jeremyevans)
|
34
|
+
|
35
|
+
* Handle passing keyword arguments through the class method to a method defined in dataset_module on Ruby 2.7+ (adam12) (#1713)
|
36
|
+
|
37
|
+
* Stream result sets in the odbc adapter for better performance and lower memory usage (sparrovv) (#1711)
|
38
|
+
|
39
|
+
* Add Postgres::JSONBOp#set_lax and #path_*_tz methods to the pg_json_ops extension for new jsonb functions added in PostgreSQL 13 (jeremyevans)
|
40
|
+
|
41
|
+
* Add Dataset#with_ties on PostgreSQL 13+ and Microsoft SQL Server to include rows with same order as final row (jeremyevans)
|
42
|
+
|
43
|
+
* Add a :current_schema option to Database#view_exists? (only defined on Oracle) to look in the current schema instead of non-system schemas (jeremyevans) (#1710)
|
44
|
+
|
45
|
+
* Recognize another disconnect error in the mysql and mysql2 adapters (jeremyevans) (#1706)
|
46
|
+
|
47
|
+
=== 5.35.0 (2020-08-01)
|
48
|
+
|
49
|
+
* Recognize another disconnect error in the oracle adapter (sterlzbd) (#1705)
|
50
|
+
|
51
|
+
* Consider all associations with :dataset options as instance-specific associations (jeremyevans)
|
52
|
+
|
53
|
+
* Make Model.finalize_associations not break with instance-specific associations (jeremyevans)
|
54
|
+
|
55
|
+
* Make association placeholder loader consider block if instance_specific: false association option is used (jeremyevans)
|
56
|
+
|
57
|
+
* Copy composite unique constraints when emulating alter table operations on SQLite (jeremyevans) (#1704)
|
58
|
+
|
59
|
+
* Add instance_specific_default plugin for setting default association :instance_specific value, or warning/raising for cases where it is not specified (jeremyevans)
|
60
|
+
|
61
|
+
* Make Model.plugin issue deprecation warning if loading plugin with arguments and block if plugin does not accept arguments/block (jeremyevans)
|
62
|
+
|
63
|
+
* Make validation_class_methods consider all :if, :allow_missing, :allow_nil, and :allow_blank settings, instead of just the first (jeremyevans)
|
64
|
+
|
65
|
+
* Include hash entries with nil keys in Dataset#to_dot output in to_dot extension (jeremyevans)
|
66
|
+
|
67
|
+
* Remove unneeded conditionals from plugins and extensions (jeremyevans)
|
68
|
+
|
69
|
+
* Fix exception class in run_transaction_hooks extension if calling run_after_{commit,rollback}_hooks outside of a transaction (jeremyevans)
|
70
|
+
|
71
|
+
=== 5.34.0 (2020-07-01)
|
72
|
+
|
73
|
+
* Make eager_graph work correctly if called with no associations (jeremyevans)
|
74
|
+
|
75
|
+
* Make :ruby eager limit strategy handle cases where there is no limit or offset (jeremyevans)
|
76
|
+
|
77
|
+
* Do not keep a reference to a Sequel::Database instance that raises an exception during initialization (jeremyevans)
|
78
|
+
|
79
|
+
* Make Database#pool.all_connections not yield for a single connection pool in disconnected state (jeremyevans)
|
80
|
+
|
81
|
+
* Raise an exception if trying to disconnect a server that doesn't exist in the sharded connection pools (jeremyevans)
|
82
|
+
|
83
|
+
* Support :refresh option when calling *_pks getter method in the association_pks plugin (jeremyevans)
|
84
|
+
|
85
|
+
* Support caching of repeated calls to *_pks getter method in the association_pks plugin using :cache_pks association option (jeremyevans)
|
86
|
+
|
87
|
+
* Add *_pks_dataset methods for one_to_many and many_to_many associations when using the association_pks plugin (jeremyevans)
|
88
|
+
|
1
89
|
=== 5.33.0 (2020-06-01)
|
2
90
|
|
3
91
|
* Support custom join types on a per-association basis when using eager_graph/association_join (jeremyevans)
|
data/README.rdoc
CHANGED
@@ -172,7 +172,7 @@ Datasets are the primary way records are retrieved and manipulated. They are ge
|
|
172
172
|
posts = DB.from(:posts)
|
173
173
|
posts = DB[:posts] # same
|
174
174
|
|
175
|
-
Datasets will only fetch records when you tell them to. They can be manipulated to filter records, change ordering, join tables, etc
|
175
|
+
Datasets will only fetch records when you tell them to. They can be manipulated to filter records, change ordering, join tables, etc. Datasets are always frozen, and they are safe to use by multiple threads concurrently.
|
176
176
|
|
177
177
|
=== Retrieving Records
|
178
178
|
|
data/doc/association_basics.rdoc
CHANGED
@@ -1676,11 +1676,16 @@ instances.
|
|
1676
1676
|
==== :instance_specific
|
1677
1677
|
|
1678
1678
|
This allows you to override the setting of whether the dataset contains instance
|
1679
|
-
specific code.
|
1679
|
+
specific code. If you are passing a block to the association,
|
1680
1680
|
Sequel sets this to true by default, which disables some optimizations that
|
1681
1681
|
would be invalid if the association is instance specific. If you know that the
|
1682
1682
|
block does not contain instance specific code, you can set this to false to
|
1683
|
-
reenable the optimizations.
|
1683
|
+
reenable the optimizations. Instance specific code is mostly commonly calling
|
1684
|
+
model instance methods inside an association block, but also
|
1685
|
+
includes cases where the association block can return different values based
|
1686
|
+
on the runtime environment, such as calls to <tt>Time.now</tt> in the block.
|
1687
|
+
Associations that use the :dataset option are always considered instance specific,
|
1688
|
+
even if explicitly specified otherwise.
|
1684
1689
|
|
1685
1690
|
==== :cartesian_product_number
|
1686
1691
|
|
data/doc/dataset_filtering.rdoc
CHANGED
@@ -36,8 +36,8 @@ Ranges (both inclusive and exclusive) can also be used:
|
|
36
36
|
|
37
37
|
If you need to select multiple items from a dataset, you can supply an array:
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
items.where(id: [1, 38, 47, 99]).sql
|
40
|
+
# "SELECT * FROM items WHERE (id IN (1, 38, 47, 99))"
|
41
41
|
|
42
42
|
== Filtering using expressions
|
43
43
|
|
data/doc/model_plugins.rdoc
CHANGED
@@ -212,7 +212,7 @@ In general you should only require plugin arguments if you absolutely must have
|
|
212
212
|
|
213
213
|
== Handling Subclasses
|
214
214
|
|
215
|
-
Sequel::Model uses a copy-on-subclassing approach to model state. So instead of model
|
215
|
+
Sequel::Model uses a copy-on-subclassing approach to model state. So instead of having a model subclass ask its superclass for a value if the subclass don't have the value defined, the value should be copied from the parent class to the subclass when the subclass is created. While this can be implemented by overriding the +inherited+ class method, there is an available shortcut that handles most cases:
|
216
216
|
|
217
217
|
module Sequel::Plugins::Foo
|
218
218
|
module ClassMethods
|
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,40 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* The association_pks plugin now creates *_pks_dataset methods for
|
4
|
+
each association. These are similar to the existing *_pks getter
|
5
|
+
methods, but they return a dataset of the keys instead of the keys
|
6
|
+
themselves.
|
7
|
+
|
8
|
+
* The association_pks plugin now supports a :cache_pks association
|
9
|
+
option, which will cache calls to the *_pks getter method. The
|
10
|
+
default behavior remains that the *_pks getter method only returns
|
11
|
+
cached values if the *_pks= setter method has been used to set the
|
12
|
+
values.
|
13
|
+
|
14
|
+
* The *_pks getter methods supported by the association_pks plugin
|
15
|
+
now support a :refresh option to ignore any cached values, similar
|
16
|
+
to how the association getter methods work.
|
17
|
+
|
18
|
+
= Other Improvements
|
19
|
+
|
20
|
+
* If trying to disconnect a server that doesn't exist when using a
|
21
|
+
sharded connection pool, a Sequel::Error is now raised. Previously,
|
22
|
+
the sharded threaded pool raised a NoMethodError and the sharded
|
23
|
+
single connection pool did not raise an error.
|
24
|
+
|
25
|
+
* If using the :savepoint option when savepoints are not supported,
|
26
|
+
a Sequel::InvalidOperation exception is now raised, instead of a
|
27
|
+
NoMethodError.
|
28
|
+
|
29
|
+
* Calling Dataset#eager_graph with no arguments now returns the
|
30
|
+
dataset.
|
31
|
+
|
32
|
+
* If not connected to the database, the single connection pool will
|
33
|
+
not yield any connections to Database#pool.all_connections.
|
34
|
+
|
35
|
+
* Forcing a :ruby eager limit strategy for an association without a
|
36
|
+
limit or offset now works correctly.
|
37
|
+
|
38
|
+
* Multiple unnecessary conditionals have been removed.
|
39
|
+
|
40
|
+
* Sequel core and model code now have 100% branch coverage.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* An instance_specific_default plugin has been added for setting the
|
4
|
+
default for the :instance_specific association option, or
|
5
|
+
warning/raises in cases where it is not specified. This allows
|
6
|
+
you to easily find associations that would be considering instance
|
7
|
+
specific by default, and mark them as not instance specific for
|
8
|
+
better performance.
|
9
|
+
|
10
|
+
= Other Improvements
|
11
|
+
|
12
|
+
* Setting the :instance_specific association option to false now
|
13
|
+
works correctly if the association uses a block. Associations
|
14
|
+
that set the :dataset option are now always considered instance
|
15
|
+
specific, even if the :instance_specific option is explicitly
|
16
|
+
passed.
|
17
|
+
|
18
|
+
* The validation_class_methods plugin now considers all :if,
|
19
|
+
:allow_missing, :allow_nil, and :allow_blank options. Previously,
|
20
|
+
it only considered the first of those options that was set.
|
21
|
+
|
22
|
+
* Model.finalize_associations no longer breaks if you have
|
23
|
+
instance-specific associations.
|
24
|
+
|
25
|
+
* Model.plugin now warns if you load the plugin with arguments or a
|
26
|
+
block if the plugin does not accept arguments or block. This is
|
27
|
+
because a future change to Sequel could break the call.
|
28
|
+
|
29
|
+
* When emulating unsupported alter table operations on SQLite, Sequel
|
30
|
+
now copies composite unique constraints unless the alter table
|
31
|
+
operation is the dropping of a unique constraint.
|
32
|
+
|
33
|
+
* Sequel now recognizes an additional disconnect error in the oracle
|
34
|
+
adapter.
|
35
|
+
|
36
|
+
* In the run_transaction_hooks extension, calling
|
37
|
+
run_after_{commit,rollback}_hooks now raises the correct exception
|
38
|
+
class.
|
39
|
+
|
40
|
+
* In the pg_range extension, conversion procs for the tsrange[] and
|
41
|
+
tstzrange[] types are not added unless the Database uses the
|
42
|
+
pg_array extension.
|
43
|
+
|
44
|
+
* Multiple unnecessary conditionals in plugins and extensions have
|
45
|
+
been removed.
|
46
|
+
|
47
|
+
* Sequel plugin and extension code now have 100% branch coverage.
|
48
|
+
|
49
|
+
* Sequel now avoids a statement not reached verbose warning in
|
50
|
+
Dataset#clone.
|
51
|
+
|
52
|
+
= Backwards Compatibility
|
53
|
+
|
54
|
+
* The output of Dataset#to_dot in the to_dot extension has changed
|
55
|
+
slightly, including hash entries with nil keys. These entries
|
56
|
+
were previously ignored.
|
@@ -0,0 +1,60 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Dataset#with_ties has been added on PostgreSQL 13+ and Microsoft
|
4
|
+
SQL Server, which will have a limited dataset also return all
|
5
|
+
rows with the same order as the final row.
|
6
|
+
|
7
|
+
* In the pg_json_ops extension, the following methods have been
|
8
|
+
added to Postgres::JSONBOp, all of which require PostgreSQL 13+:
|
9
|
+
|
10
|
+
* #set_lax
|
11
|
+
* #path_exists_tz!
|
12
|
+
* #path_match_tz!
|
13
|
+
* #path_query_tz
|
14
|
+
* #path_query_array_tz
|
15
|
+
* #path_query_first_tz
|
16
|
+
|
17
|
+
* On Oracle, the Database#view_exists? method now accepts a
|
18
|
+
:current_schema option to limit the views returned to the
|
19
|
+
current schema, instead of all non-system schemas.
|
20
|
+
|
21
|
+
= Other Improvements
|
22
|
+
|
23
|
+
* Sequel will now pass keyword arguments through in the following
|
24
|
+
cases:
|
25
|
+
|
26
|
+
* When loading plugins (Model.plugin)
|
27
|
+
|
28
|
+
* Class methods automically defined for methods defined in a
|
29
|
+
Model.dataset_module block
|
30
|
+
|
31
|
+
* Methods defined by Plugins.def_dataset_method
|
32
|
+
|
33
|
+
* Database methods called inside migrations
|
34
|
+
|
35
|
+
* Methods called via an association proxy when using the
|
36
|
+
association_proxies plugin.
|
37
|
+
|
38
|
+
* Dataset methods called inside a Dataset#query block when using
|
39
|
+
the query extension.
|
40
|
+
|
41
|
+
Previously, keywords were not handled in these cases, which would
|
42
|
+
cause deprecation warnings in Ruby 2.7 and ArgumentErrors in Ruby
|
43
|
+
3.0. Note that Sequel itself does not use keyword arguments at
|
44
|
+
all, so all of these changes only affect cases where external
|
45
|
+
methods are defined that accept keywords, and Sequel methods are
|
46
|
+
called with keywords that end up being delegated to the external
|
47
|
+
methods.
|
48
|
+
|
49
|
+
* The odbc adapter will now stream result sets instead of loading
|
50
|
+
the entire result set in memory and then iterating over it.
|
51
|
+
|
52
|
+
* Sequel now recognizes another disconnect error in the mysql and
|
53
|
+
mysql2 adapters.
|
54
|
+
|
55
|
+
= Backwards Compatibility
|
56
|
+
|
57
|
+
* Due to the odbc adapter change to use streaming, issuing queries
|
58
|
+
inside a Dataset#each block will no longer work unless a different
|
59
|
+
shard or thread is used. The behavior of such code is considered
|
60
|
+
undefined on all Sequel adapters.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
= New Features
|
2
|
+
|
3
|
+
* Model#column_previously_was and #column_previously_changed? have
|
4
|
+
been added to the dirty plugin, for getting the previous values
|
5
|
+
of the column before saving and for whether there were changes
|
6
|
+
before saving.
|
7
|
+
|
8
|
+
Model#column_previously_changed? accepts :from and :to options
|
9
|
+
to allow you to more easily determine if the value changed from
|
10
|
+
and/or to specific values.
|
11
|
+
|
12
|
+
This information was previously obtainable via
|
13
|
+
Model#previous_changes, but these new methods offer a friendlier
|
14
|
+
interface.
|
15
|
+
|
16
|
+
* Postgres::PGRow::{Array,Hash}Row#op has been added to the
|
17
|
+
pg_row_ops extension if the pg_row extension is loaded. This
|
18
|
+
is similar to how the pg_array_ops, pg_hstore_ops, and
|
19
|
+
pg_json_ops and #op method to their objects. This makes it
|
20
|
+
easier to perform row operations on literal rows.
|
21
|
+
|
22
|
+
= Other Improvements
|
23
|
+
|
24
|
+
* The schema_dumper extension now supports more unsigned numeric
|
25
|
+
types, such as "decimal(7,2) unsigned" and "real unsigned".
|
26
|
+
|
27
|
+
* IntegerMigrator now raises an Migrator::Error if attempting to
|
28
|
+
migrate down when there are migration files missing and needed for
|
29
|
+
the down migration. Previously, IntegerMigrator would not raise an
|
30
|
+
exception and would make no database changes in this case.
|
@@ -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/doc/transactions.rdoc
CHANGED
@@ -143,14 +143,6 @@ If you want the current savepoint to be rolled back when the savepoint block exi
|
|
143
143
|
end # RELEASE SAVEPOINT
|
144
144
|
end # COMMIT
|
145
145
|
|
146
|
-
If you want the current savepoint to be rolled back when the savepoint block exits (even if an exception is not raised), use <tt>Database#rollback_on_exit(:savepoint=>true)</tt>
|
147
|
-
|
148
|
-
DB.transaction do # BEGIN
|
149
|
-
DB.transaction(savepoint: true) do # SAVEPOINT
|
150
|
-
DB.rollback_on_exit(:savepoint=>true)
|
151
|
-
end # ROLLBACK TO SAVEPOINT
|
152
|
-
end # COMMIT
|
153
|
-
|
154
146
|
If you want the current savepoint and potentially enclosing savepoints to be rolled back when the savepoint blocks exit (even if an exception is not raised), use <tt>Database#rollback_on_exit(:savepoint=>integer)</tt>
|
155
147
|
|
156
148
|
DB.transaction do # BEGIN
|
data/doc/validations.rdoc
CHANGED
@@ -232,7 +232,7 @@ These methods check that the specified attributes can be valid integers or valid
|
|
232
232
|
|
233
233
|
=== +validates_operator+
|
234
234
|
|
235
|
-
+validates_operator+ checks that a given +operator+ method returns a truthy value when called on attribute with a specified value for comparison. Generally, this is used for inequality checks (>, >=, etc) but any method that can be called on the attribute that accepts an argument and returns a truthy value may be used.
|
235
|
+
+validates_operator+ checks that a given +operator+ method returns a truthy value when called on attribute with a specified value for comparison. Generally, this is used for inequality checks (>, >=, etc.) but any method that can be called on the attribute that accepts an argument and returns a truthy value may be used.
|
236
236
|
|
237
237
|
class Album < Sequel::Model
|
238
238
|
def validate
|
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
|
|