sequel 5.106.0 → 5.108.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.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sequel +5 -5
  3. data/lib/sequel/adapters/ado.rb +1 -1
  4. data/lib/sequel/adapters/ibmdb.rb +2 -2
  5. data/lib/sequel/adapters/jdbc/hsqldb.rb +1 -1
  6. data/lib/sequel/adapters/jdbc/mysql.rb +1 -1
  7. data/lib/sequel/adapters/jdbc.rb +2 -2
  8. data/lib/sequel/adapters/mock.rb +1 -1
  9. data/lib/sequel/adapters/mysql.rb +7 -2
  10. data/lib/sequel/adapters/mysql2.rb +5 -4
  11. data/lib/sequel/adapters/postgres.rb +37 -37
  12. data/lib/sequel/adapters/shared/db2.rb +2 -2
  13. data/lib/sequel/adapters/shared/mssql.rb +4 -4
  14. data/lib/sequel/adapters/shared/mysql.rb +2 -2
  15. data/lib/sequel/adapters/shared/postgres.rb +997 -38
  16. data/lib/sequel/adapters/shared/sqlite.rb +8 -7
  17. data/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +1 -1
  18. data/lib/sequel/adapters/utils/mysql_mysql2.rb +11 -1
  19. data/lib/sequel/connection_pool/sharded_single.rb +1 -1
  20. data/lib/sequel/connection_pool/sharded_threaded.rb +7 -5
  21. data/lib/sequel/connection_pool/sharded_timed_queue.rb +3 -3
  22. data/lib/sequel/connection_pool/threaded.rb +9 -7
  23. data/lib/sequel/connection_pool/timed_queue.rb +2 -2
  24. data/lib/sequel/connection_pool.rb +3 -3
  25. data/lib/sequel/core.rb +30 -22
  26. data/lib/sequel/database/connecting.rb +1 -1
  27. data/lib/sequel/database/features.rb +1 -1
  28. data/lib/sequel/database/misc.rb +7 -7
  29. data/lib/sequel/database/query.rb +2 -2
  30. data/lib/sequel/database/schema_generator.rb +7 -5
  31. data/lib/sequel/database/schema_methods.rb +2 -2
  32. data/lib/sequel/database/transactions.rb +4 -4
  33. data/lib/sequel/dataset/actions.rb +1 -1
  34. data/lib/sequel/dataset/features.rb +4 -4
  35. data/lib/sequel/dataset/graph.rb +1 -1
  36. data/lib/sequel/dataset/misc.rb +3 -3
  37. data/lib/sequel/dataset/prepared_statements.rb +2 -2
  38. data/lib/sequel/dataset/query.rb +8 -8
  39. data/lib/sequel/dataset/sql.rb +18 -10
  40. data/lib/sequel/dataset.rb +2 -2
  41. data/lib/sequel/deprecated.rb +2 -2
  42. data/lib/sequel/exceptions.rb +2 -2
  43. data/lib/sequel/extensions/_pretty_table.rb +1 -1
  44. data/lib/sequel/extensions/async_thread_pool.rb +3 -3
  45. data/lib/sequel/extensions/auto_cast_date_and_time.rb +2 -2
  46. data/lib/sequel/extensions/blank.rb +2 -2
  47. data/lib/sequel/extensions/constraint_validations.rb +1 -1
  48. data/lib/sequel/extensions/core_refinements.rb +8 -8
  49. data/lib/sequel/extensions/date_arithmetic.rb +1 -1
  50. data/lib/sequel/extensions/datetime_parse_to_time.rb +2 -2
  51. data/lib/sequel/extensions/duplicate_columns_handler.rb +2 -2
  52. data/lib/sequel/extensions/graph_each.rb +1 -1
  53. data/lib/sequel/extensions/index_caching.rb +1 -1
  54. data/lib/sequel/extensions/inflector.rb +5 -5
  55. data/lib/sequel/extensions/is_distinct_from.rb +2 -2
  56. data/lib/sequel/extensions/lit_require_frozen.rb +3 -3
  57. data/lib/sequel/extensions/migration.rb +21 -7
  58. data/lib/sequel/extensions/named_timezones.rb +8 -8
  59. data/lib/sequel/extensions/pg_array.rb +9 -8
  60. data/lib/sequel/extensions/pg_array_ops.rb +69 -14
  61. data/lib/sequel/extensions/pg_auto_parameterize.rb +2 -2
  62. data/lib/sequel/extensions/pg_auto_parameterize_in_array.rb +3 -3
  63. data/lib/sequel/extensions/pg_enum.rb +2 -2
  64. data/lib/sequel/extensions/pg_extended_date_support.rb +5 -5
  65. data/lib/sequel/extensions/pg_extended_integer_support.rb +1 -1
  66. data/lib/sequel/extensions/pg_hstore.rb +2 -2
  67. data/lib/sequel/extensions/pg_hstore_ops.rb +5 -5
  68. data/lib/sequel/extensions/pg_inet.rb +2 -2
  69. data/lib/sequel/extensions/pg_inet_ops.rb +2 -2
  70. data/lib/sequel/extensions/pg_interval.rb +6 -6
  71. data/lib/sequel/extensions/pg_json.rb +4 -4
  72. data/lib/sequel/extensions/pg_json_ops.rb +11 -11
  73. data/lib/sequel/extensions/pg_range.rb +6 -6
  74. data/lib/sequel/extensions/pg_range_ops.rb +7 -7
  75. data/lib/sequel/extensions/pg_row.rb +4 -4
  76. data/lib/sequel/extensions/pg_row_ops.rb +6 -6
  77. data/lib/sequel/extensions/provenance.rb +2 -2
  78. data/lib/sequel/extensions/query.rb +2 -2
  79. data/lib/sequel/extensions/s.rb +2 -2
  80. data/lib/sequel/extensions/schema_dumper.rb +4 -4
  81. data/lib/sequel/extensions/sequel_4_dataset_methods.rb +2 -0
  82. data/lib/sequel/extensions/sql_comments.rb +1 -1
  83. data/lib/sequel/extensions/sql_log_normalizer.rb +1 -1
  84. data/lib/sequel/extensions/sqlite_json_ops.rb +2 -2
  85. data/lib/sequel/extensions/string_agg.rb +5 -5
  86. data/lib/sequel/extensions/symbol_aref.rb +3 -3
  87. data/lib/sequel/extensions/symbol_aref_refinement.rb +3 -3
  88. data/lib/sequel/extensions/symbol_as_refinement.rb +2 -2
  89. data/lib/sequel/extensions/transaction_connection_validator.rb +1 -1
  90. data/lib/sequel/model/associations.rb +17 -17
  91. data/lib/sequel/model/base.rb +19 -11
  92. data/lib/sequel/model/inflections.rb +1 -1
  93. data/lib/sequel/model/plugins.rb +2 -2
  94. data/lib/sequel/model.rb +2 -2
  95. data/lib/sequel/plugins/association_pks.rb +1 -1
  96. data/lib/sequel/plugins/association_proxies.rb +4 -4
  97. data/lib/sequel/plugins/auto_restrict_eager_graph.rb +2 -0
  98. data/lib/sequel/plugins/caching.rb +1 -1
  99. data/lib/sequel/plugins/class_table_inheritance.rb +1 -1
  100. data/lib/sequel/plugins/column_encryption.rb +10 -10
  101. data/lib/sequel/plugins/concurrent_eager_loading.rb +2 -2
  102. data/lib/sequel/plugins/csv_serializer.rb +2 -2
  103. data/lib/sequel/plugins/deprecated_associations.rb +2 -2
  104. data/lib/sequel/plugins/eager_each.rb +1 -1
  105. data/lib/sequel/plugins/finder.rb +1 -1
  106. data/lib/sequel/plugins/forbid_lazy_load.rb +3 -3
  107. data/lib/sequel/plugins/insert_conflict.rb +1 -1
  108. data/lib/sequel/plugins/insert_returning_select.rb +1 -1
  109. data/lib/sequel/plugins/json_serializer.rb +4 -4
  110. data/lib/sequel/plugins/lazy_attributes.rb +1 -1
  111. data/lib/sequel/plugins/many_through_many.rb +1 -1
  112. data/lib/sequel/plugins/pg_array_associations.rb +4 -4
  113. data/lib/sequel/plugins/pg_auto_constraint_validations.rb +3 -3
  114. data/lib/sequel/plugins/pg_eager_any_typed_array.rb +2 -2
  115. data/lib/sequel/plugins/prepared_statements.rb +2 -2
  116. data/lib/sequel/plugins/serialization.rb +1 -1
  117. data/lib/sequel/plugins/sharding.rb +1 -1
  118. data/lib/sequel/plugins/single_table_inheritance.rb +1 -1
  119. data/lib/sequel/plugins/skip_saving_columns.rb +2 -2
  120. data/lib/sequel/plugins/split_values.rb +1 -1
  121. data/lib/sequel/plugins/sql_comments.rb +8 -8
  122. data/lib/sequel/plugins/subclasses.rb +6 -6
  123. data/lib/sequel/plugins/subset_conditions.rb +2 -2
  124. data/lib/sequel/plugins/tactical_eager_loading.rb +1 -1
  125. data/lib/sequel/plugins/throw_failures.rb +2 -2
  126. data/lib/sequel/plugins/unused_associations.rb +5 -5
  127. data/lib/sequel/plugins/validation_helpers.rb +1 -1
  128. data/lib/sequel/plugins/xml_serializer.rb +2 -0
  129. data/lib/sequel/sql.rb +11 -11
  130. data/lib/sequel/version.rb +1 -1
  131. metadata +2 -2
@@ -74,9 +74,9 @@ module Sequel
74
74
  raise(Sequel::Error, "method #{method.inspect} did not return a dataset") unless @dataset.is_a?(Dataset)
75
75
  self
76
76
  end
77
- # :nocov:
77
+ # simplecov:disable
78
78
  ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
79
- # :nocov:
79
+ # simplecov:enable
80
80
  end
81
81
  end
82
82
 
@@ -49,10 +49,10 @@ module Sequel::S
49
49
  Sequel.expr(*a, &block)
50
50
  end
51
51
 
52
- # :nocov:
52
+ # simplecov:disable
53
53
  if RUBY_VERSION >= '2.0.0'
54
54
  include_meth = RUBY_VERSION >= '3.1' ? :import_methods : :include
55
- # :nocov:
55
+ # simplecov:enable
56
56
  refine Object do
57
57
  send include_meth, Sequel::S
58
58
  end
@@ -27,9 +27,9 @@ Sequel.extension :eval_inspect
27
27
 
28
28
  module Sequel
29
29
  module SchemaDumper
30
- # :nocov:
30
+ # simplecov:disable
31
31
  IGNORE_INDEX_ERRORS_KEY = RUBY_VERSION >= '3.4' ? 'ignore_index_errors: ' : ':ignore_index_errors=>'
32
- # :nocov:
32
+ # simplecov:enable
33
33
  private_constant :IGNORE_INDEX_ERRORS_KEY
34
34
 
35
35
  # Convert the column schema information to a hash of column options, one of which must
@@ -430,10 +430,10 @@ END_MIG
430
430
 
431
431
  module Schema
432
432
  class CreateTableGenerator
433
- # :nocov:
433
+ # simplecov:disable
434
434
  DEFAULT_KEY = RUBY_VERSION >= '3.4' ? 'default: ' : ':default=>'
435
435
  IGNORE_ERRORS_KEY = RUBY_VERSION >= '3.4' ? 'ignore_errors: ' : ':ignore_errors=>'
436
- # :nocov:
436
+ # simplecov:enable
437
437
  private_constant :DEFAULT_KEY
438
438
  private_constant :IGNORE_ERRORS_KEY
439
439
 
@@ -21,6 +21,8 @@
21
21
  #
22
22
  # Related module: Sequel::Sequel4DatasetMethods
23
23
 
24
+ # SEQUEL6: Remove
25
+
24
26
  #
25
27
  module Sequel
26
28
  module Sequel4DatasetMethods
@@ -108,7 +108,7 @@ module Sequel
108
108
  # injection.
109
109
  #
110
110
  # Additionally, due to the use of an SQL comment, if any
111
- # SQL is appened to the query after the comment is added,
111
+ # SQL is appended to the query after the comment is added,
112
112
  # it will become part of the comment unless it is preceded
113
113
  # by a newline.
114
114
  if sql.frozen?
@@ -14,7 +14,7 @@
14
14
  # The normalization is done by scanning the SQL string being executed
15
15
  # for literal strings and numbers, and replacing them with question
16
16
  # marks. While this should work for all or almost all production queries,
17
- # there are pathlogical queries that will not be handled correctly, such as
17
+ # there are pathological queries that will not be handled correctly, such as
18
18
  # the use of apostrophes in identifiers:
19
19
  #
20
20
  # DB[:"asf'bar"].where(a: 1, b: 'something').first
@@ -296,7 +296,7 @@ module Sequel
296
296
  end
297
297
  end
298
298
 
299
- # :nocov:
299
+ # simplecov:disable
300
300
  if Sequel.core_extensions?
301
301
  class Symbol
302
302
  include Sequel::SQLite::JSONOpMethods
@@ -310,4 +310,4 @@ if defined?(Sequel::CoreRefinements)
310
310
  end
311
311
  end
312
312
  end
313
- # :nocov:
313
+ # simplecov:enable
@@ -1,7 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
  #
3
3
  # The string_agg extension adds the ability to perform database-independent
4
- # aggregate string concatentation. For example, with a table like:
4
+ # aggregate string concatenation. For example, with a table like:
5
5
  #
6
6
  # c1 | c2
7
7
  # ---+---
@@ -28,7 +28,7 @@
28
28
  # # or:
29
29
  # sa = Sequel.string_agg(:column_name, '-') # custom separator
30
30
  #
31
- # You can specify the order in which the concatention happens by
31
+ # You can specify the order in which the concatenation happens by
32
32
  # calling +order+ on the expression:
33
33
  #
34
34
  # sa = Sequel.string_agg(:column_name).order(:other_column)
@@ -45,7 +45,7 @@
45
45
  # select_group(:c1).
46
46
  # select_append(Sequel.string_agg(:c2))
47
47
  #
48
- # This extension currenly supports the following databases:
48
+ # This extension currently supports the following databases:
49
49
  #
50
50
  # * PostgreSQL 9+
51
51
  # * SQLAnywhere 12+
@@ -62,13 +62,13 @@
62
62
  module Sequel
63
63
  module SQL
64
64
  module Builders
65
- # Return a StringAgg expression for an aggregate string concatentation.
65
+ # Return a StringAgg expression for an aggregate string concatenation.
66
66
  def string_agg(*a)
67
67
  StringAgg.new(*a)
68
68
  end
69
69
  end
70
70
 
71
- # The StringAgg class represents an aggregate string concatentation.
71
+ # The StringAgg class represents an aggregate string concatenation.
72
72
  class StringAgg < GenericExpression
73
73
  include StringMethods
74
74
  include StringConcatenationMethods
@@ -1,7 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
  #
3
3
  # The symbol_aref extension makes Symbol#[] support Symbol,
4
- # Sequel::SQL::Indentifier, and Sequel::SQL::QualifiedIdentifier instances,
4
+ # Sequel::SQL::Identifier, and Sequel::SQL::QualifiedIdentifier instances,
5
5
  # returning appropriate Sequel::SQL::QualifiedIdentifier instances. It's
6
6
  # designed as a shortcut so that instead of:
7
7
  #
@@ -35,7 +35,7 @@ if RUBY_VERSION >= '2.0'
35
35
  class Symbol
36
36
  prepend Sequel::SymbolAref
37
37
  end
38
- # :nocov:
38
+ # simplecov:disable
39
39
  else
40
40
  class Symbol
41
41
  if method_defined?(:[])
@@ -52,4 +52,4 @@ else
52
52
  end
53
53
  end
54
54
  end
55
- # :nocov:
55
+ # simplecov:enable
@@ -1,7 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
  #
3
3
  # The symbol_aref_refinement extension adds a refinement that makes
4
- # Symbol#[] support Symbol, #Sequel::SQL::Indentifier, and
4
+ # Symbol#[] support Symbol, #Sequel::SQL::Identifier, and
5
5
  # Sequel::SQL::QualifiedIdentifier instances, returning appropriate
6
6
  # Sequel::SQL::QualifiedIdentifier instances. It's designed as a
7
7
  # shortcut so that instead of:
@@ -25,9 +25,9 @@
25
25
  #
26
26
  # Related module: Sequel::SymbolAref
27
27
 
28
- # :nocov:
28
+ # simplecov:disable
29
29
  raise(Sequel::Error, "Refinements require ruby 2.0.0 or greater") unless RUBY_VERSION >= '2.0.0'
30
- # :nocov:
30
+ # simplecov:enable
31
31
 
32
32
  module Sequel::SymbolAref
33
33
  refine Symbol do
@@ -23,9 +23,9 @@
23
23
  #
24
24
  # Related module: Sequel::SymbolAs
25
25
 
26
- # :nocov:
26
+ # simplecov:disable
27
27
  raise(Sequel::Error, "Refinements require ruby 2.0.0 or greater") unless RUBY_VERSION >= '2.0.0'
28
- # :nocov:
28
+ # simplecov:enable
29
29
 
30
30
  module Sequel::SymbolAs
31
31
  refine Symbol do
@@ -33,7 +33,7 @@ module Sequel
33
33
  end
34
34
 
35
35
  # Rescue disconnect errors raised when beginning a new transaction. If there
36
- # is a disconnnect error, it should be safe to retry the transaction using a
36
+ # is a disconnect error, it should be safe to retry the transaction using a
37
37
  # new connection, as we haven't yielded control to the user yet.
38
38
  def transaction(opts=OPTS)
39
39
  super
@@ -383,7 +383,7 @@ module Sequel
383
383
  end
384
384
 
385
385
  # Finalize the association by first attempting to populate the thread-safe cache,
386
- # and then transfering the thread-safe cache value to the association itself,
386
+ # and then transferring the thread-safe cache value to the association itself,
387
387
  # so that a mutex is not needed to get the value.
388
388
  def finalize
389
389
  return unless cache = self[:cache]
@@ -1174,7 +1174,7 @@ module Sequel
1174
1174
  private
1175
1175
 
1176
1176
  # Use a correlated subquery to limit the dataset. Note that this will not
1177
- # work correctly if the associated dataset uses qualified identifers in the WHERE clause,
1177
+ # work correctly if the associated dataset uses qualified identifiers in the WHERE clause,
1178
1178
  # as they would reference the containing query instead of the subquery.
1179
1179
  def apply_correlated_subquery_limit_strategy(ds)
1180
1180
  table = ds.first_source_table
@@ -1191,7 +1191,7 @@ module Sequel
1191
1191
  end
1192
1192
 
1193
1193
  # Use a LATERAL subquery to limit the dataset. Note that this will not
1194
- # work correctly if the associated dataset uses qualified identifers in the WHERE clause,
1194
+ # work correctly if the associated dataset uses qualified identifiers in the WHERE clause,
1195
1195
  # as they would reference the containing query instead of the subquery.
1196
1196
  #
1197
1197
  # This does not contain the conditions that are necessary to join to the
@@ -1821,7 +1821,7 @@ module Sequel
1821
1821
  # The following options can be supplied:
1822
1822
  # === Multiple Types
1823
1823
  # :adder :: Proc used to define the private _add_* method for doing the database work
1824
- # to associate the given object to the current object (*_to_many assocations).
1824
+ # to associate the given object to the current object (*_to_many associations).
1825
1825
  # Set to nil to not define a add_* method for the association.
1826
1826
  # :after_add :: Symbol, Proc, or array of both/either specifying a callback to call
1827
1827
  # after a new item is added to the association.
@@ -1852,7 +1852,7 @@ module Sequel
1852
1852
  # :class_namespace :: If :class is given as a string or symbol, sets the default namespace in which to look for
1853
1853
  # the class. <tt>class: 'Foo', class_namespace: 'Bar'</tt> looks for <tt>::Bar::Foo</tt>.)
1854
1854
  # :clearer :: Proc used to define the private _remove_all_* method for doing the database work
1855
- # to remove all objects associated to the current object (*_to_many assocations).
1855
+ # to remove all objects associated to the current object (*_to_many associations).
1856
1856
  # Set to nil to not define a remove_all_* method for the association.
1857
1857
  # :clone :: Merge the current options and block into the options and block used in defining
1858
1858
  # the given association. Can be used to DRY up a bunch of similar associations that
@@ -1939,10 +1939,10 @@ module Sequel
1939
1939
  # or add_/remove_/remove_all_ methods (for one_to_many and many_to_many associations).
1940
1940
  # :reciprocal :: the symbol name of the reciprocal association,
1941
1941
  # if it exists. By default, Sequel will try to determine it by looking at the
1942
- # associated model's assocations for a association that matches
1942
+ # associated model's associations for a association that matches
1943
1943
  # the current association's key(s). Set to nil to not use a reciprocal.
1944
1944
  # :remover :: Proc used to define the private _remove_* method for doing the database work
1945
- # to remove the association between the given object and the current object (*_to_many assocations).
1945
+ # to remove the association between the given object and the current object (*_to_many associations).
1946
1946
  # Set to nil to not define a remove_* method for the association.
1947
1947
  # :select :: the columns to select. Defaults to the associated class's table_name.* in an association
1948
1948
  # that uses joins, which means it doesn't include the attributes from the
@@ -1950,7 +1950,7 @@ module Sequel
1950
1950
  # use this option, but beware that the join table attributes can clash with
1951
1951
  # attributes from the model table, so you should alias any attributes that have
1952
1952
  # the same name in both the join table and the associated table.
1953
- # :setter :: Proc used to define the private _*= method for doing the work to setup the assocation
1953
+ # :setter :: Proc used to define the private _*= method for doing the work to setup the association
1954
1954
  # between the given object and the current object (*_to_one associations).
1955
1955
  # Set to nil to not define a setter method for the association.
1956
1956
  # :subqueries_per_union :: The number of subqueries to use in each UNION query, for eager
@@ -2208,9 +2208,9 @@ module Sequel
2208
2208
  def association_module_delegate_def(name, opts, &block)
2209
2209
  mod = association_module(opts)
2210
2210
  mod.send(:define_method, name, &block)
2211
- # :nocov:
2211
+ # simplecov:disable
2212
2212
  mod.send(:ruby2_keywords, name) if mod.respond_to?(:ruby2_keywords, true)
2213
- # :nocov:
2213
+ # simplecov:enable
2214
2214
  mod.send(:alias_method, name, name)
2215
2215
  end
2216
2216
 
@@ -2819,9 +2819,9 @@ module Sequel
2819
2819
  run_association_callbacks(opts, :after_add, o)
2820
2820
  o
2821
2821
  end
2822
- # :nocov:
2822
+ # simplecov:disable
2823
2823
  ruby2_keywords(:add_associated_object) if respond_to?(:ruby2_keywords, true)
2824
- # :nocov:
2824
+ # simplecov:enable
2825
2825
 
2826
2826
  # Add/Set the current object to/as the given object's reciprocal association.
2827
2827
  def add_reciprocal_object(opts, o)
@@ -2964,9 +2964,9 @@ module Sequel
2964
2964
  associations[opts[:name]] = []
2965
2965
  ret
2966
2966
  end
2967
- # :nocov:
2967
+ # simplecov:disable
2968
2968
  ruby2_keywords(:remove_all_associated_objects) if respond_to?(:ruby2_keywords, true)
2969
- # :nocov:
2969
+ # simplecov:enable
2970
2970
 
2971
2971
  # Remove the given associated object from the given association
2972
2972
  def remove_associated_object(opts, o, *args)
@@ -2988,9 +2988,9 @@ module Sequel
2988
2988
  run_association_callbacks(opts, :after_remove, o)
2989
2989
  o
2990
2990
  end
2991
- # :nocov:
2991
+ # simplecov:disable
2992
2992
  ruby2_keywords(:remove_associated_object) if respond_to?(:ruby2_keywords, true)
2993
- # :nocov:
2993
+ # simplecov:enable
2994
2994
 
2995
2995
  # Check that the object from the associated table specified by the primary key
2996
2996
  # is currently associated to the receiver. If it is associated, return the object, otherwise
@@ -3476,7 +3476,7 @@ module Sequel
3476
3476
  # :limit_strategy :: Use a strategy for handling limits on associations.
3477
3477
  # Appropriate :limit_strategy values are:
3478
3478
  # true :: Pick the most appropriate based on what the database supports
3479
- # :distinct_on :: Force use of DISTINCT ON stategy (*_one associations only)
3479
+ # :distinct_on :: Force use of DISTINCT ON strategy (*_one associations only)
3480
3480
  # :correlated_subquery :: Force use of correlated subquery strategy (one_to_* associations only)
3481
3481
  # :window_function :: Force use of window function strategy
3482
3482
  # :ruby :: Don't modify the SQL, implement limits/offsets with array slicing
@@ -518,9 +518,9 @@ module Sequel
518
518
 
519
519
  m.configure(self, *args, &block) if m.respond_to?(:configure)
520
520
  end
521
- # :nocov:
521
+ # simplecov:disable
522
522
  ruby2_keywords(:plugin) if respond_to?(:ruby2_keywords, true)
523
- # :nocov:
523
+ # simplecov:enable
524
524
 
525
525
  # Returns primary key attribute hash. If using a composite primary key
526
526
  # value such be an array with values for each primary key in the correct
@@ -828,9 +828,9 @@ ruby2_keywords :#{meth} if respond_to?(:ruby2_keywords, true)
828
828
  END
829
829
  else
830
830
  mod.send(:define_method, meth){|*args, &block| dataset.public_send(meth, *args, &block)}
831
- # :nocov:
831
+ # simplecov:disable
832
832
  mod.send(:ruby2_keywords, meth) if respond_to?(:ruby2_keywords, true)
833
- # :nocov:
833
+ # simplecov:enable
834
834
  end
835
835
  mod.send(:alias_method, meth, meth)
836
836
  end
@@ -1830,7 +1830,7 @@ END
1830
1830
  end
1831
1831
  end
1832
1832
 
1833
- # Internal destroy method, separted from destroy to
1833
+ # Internal destroy method, separated from destroy to
1834
1834
  # allow running inside a transaction
1835
1835
  def _destroy(opts)
1836
1836
  called = false
@@ -1943,7 +1943,7 @@ END
1943
1943
  columns = opts[:columns]
1944
1944
  if columns.nil?
1945
1945
  columns_updated = if opts[:changed]
1946
- _save_update_changed_colums_hash
1946
+ _save_update_changed_columns_hash
1947
1947
  else
1948
1948
  _save_update_all_columns_hash
1949
1949
  end
@@ -1995,10 +1995,18 @@ END
1995
1995
  v
1996
1996
  end
1997
1997
 
1998
+ def _save_update_changed_colums_hash # :nodoc:
1999
+ # SEQUEL6: Remove
2000
+ # simplecov:disable
2001
+ Sequel::Deprecation.deprecate("Model#_save_update_changed_colums_hash", "Use #_save_update_changed_columns_hash instead")
2002
+ _save_update_changed_columns_hash
2003
+ # simplecov:enable
2004
+ end
2005
+
1998
2006
  # Return a hash of values used when saving changed columns of an
1999
2007
  # existing object. Defaults to all of the objects current values
2000
2008
  # that are recorded as modified.
2001
- def _save_update_changed_colums_hash
2009
+ def _save_update_changed_columns_hash
2002
2010
  cc = changed_columns
2003
2011
  @values.reject{|k,v| !cc.include?(k)}
2004
2012
  end
@@ -2426,13 +2434,13 @@ END
2426
2434
  def_initialize_nil_instance_variables
2427
2435
 
2428
2436
  singleton_class.send(:undef_method, :dup, :clone, :initialize_copy)
2429
- # :nocov:
2437
+ # simplecov:disable
2430
2438
  if RUBY_VERSION >= '1.9.3'
2431
- # :nocov:
2439
+ # simplecov:enable
2432
2440
  singleton_class.send(:undef_method, :initialize_clone, :initialize_dup)
2433
2441
  end
2434
2442
 
2435
- # :nocov:
2443
+ # simplecov:disable
2436
2444
  if defined?(Sequel::Postgres::SEQUEL_PG_VERSION_INTEGER) && Sequel::Postgres::SEQUEL_PG_VERSION_INTEGER >= 11800
2437
2445
  # Automatically optimize model loading when sequel/core was loaded,
2438
2446
  # then sequel/adapters/postgres (with sequel_pg), then sequel/model
@@ -2442,6 +2450,6 @@ END
2442
2450
  # nothing
2443
2451
  end
2444
2452
  end
2445
- # :nocov:
2453
+ # simplecov:enable
2446
2454
  end
2447
2455
  end
@@ -28,7 +28,7 @@ module Sequel
28
28
  @plurals, @singulars, @uncountables = [], [], []
29
29
 
30
30
  class << self
31
- # Array of two element arrays, first containing a regex, and the second containing a substitution pattern, used for plurization.
31
+ # Array of two element arrays, first containing a regex, and the second containing a substitution pattern, used for pluralization.
32
32
  attr_reader :plurals
33
33
 
34
34
  # Array of two element arrays, first containing a regex, and the second containing a substitution pattern, used for singularization.
@@ -31,9 +31,9 @@ module Sequel
31
31
  def self.def_dataset_methods(mod, meths)
32
32
  Array(meths).each do |meth|
33
33
  mod.class_eval("def #{meth}(*args, &block); dataset.#{meth}(*args, &block) end", __FILE__, __LINE__)
34
- # :nocov:
34
+ # simplecov:disable
35
35
  mod.send(:ruby2_keywords, meth) if respond_to?(:ruby2_keywords, true)
36
- # :nocov:
36
+ # simplecov:enable
37
37
  end
38
38
  end
39
39
 
data/lib/sequel/model.rb CHANGED
@@ -70,9 +70,9 @@ module Sequel
70
70
  require_relative "model/base"
71
71
  require_relative "model/exceptions"
72
72
  require_relative "model/errors"
73
- # :nocov:
73
+ # simplecov:disable
74
74
  if !defined?(::SEQUEL_NO_ASSOCIATIONS) && !ENV.has_key?('SEQUEL_NO_ASSOCIATIONS')
75
- # :nocov:
75
+ # simplecov:enable
76
76
  require_relative 'model/associations'
77
77
  plugin Model::Associations
78
78
  end
@@ -20,7 +20,7 @@ module Sequel
20
20
  # # Persist changes
21
21
  #
22
22
  # Note that it uses the singular form of the association name. Also note
23
- # that the setter both associates to new primary keys not in the assocation
23
+ # that the setter both associates to new primary keys not in the association
24
24
  # and disassociates from primary keys not provided to the method.
25
25
  #
26
26
  # This plugin makes modifications directly to the underlying tables,
@@ -64,7 +64,7 @@ module Sequel
64
64
  array = [].freeze
65
65
 
66
66
  if RUBY_VERSION < '2.6'
67
- # :nocov:
67
+ # simplecov:disable
68
68
 
69
69
  # Default proc used to determine whether to send the method to the dataset.
70
70
  # If the array would respond to it, sends it to the array instead of the dataset.
@@ -75,7 +75,7 @@ module Sequel
75
75
  end
76
76
  !array_method
77
77
  end
78
- # :nocov:
78
+ # simplecov:enable
79
79
  else
80
80
  DEFAULT_PROXY_TO_DATASET = proc{|opts| !array.respond_to?(opts[:method])}
81
81
  end
@@ -99,9 +99,9 @@ module Sequel
99
99
  end
100
100
  v.public_send(meth, *args, &block)
101
101
  end
102
- # :nocov:
102
+ # simplecov:disable
103
103
  ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
104
- # :nocov:
104
+ # simplecov:enable
105
105
  end
106
106
 
107
107
  module ClassMethods
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ # SEQUEL6: Merge into default associations code
4
+
3
5
  module Sequel
4
6
  module Plugins
5
7
  # The auto_restrict_eager_graph plugin will automatically disallow the use
@@ -53,7 +53,7 @@ module Sequel
53
53
  end
54
54
 
55
55
  module ClassMethods
56
- # If true, ignores exceptions when gettings cached records (the memcached API).
56
+ # If true, ignores exceptions when getting cached records (the memcached API).
57
57
  attr_reader :cache_ignore_exceptions
58
58
 
59
59
  # The cache store object for the model, which should implement the
@@ -79,7 +79,7 @@ module Sequel
79
79
  # subclass instances that only have column entries for the columns in the
80
80
  # superclass table. Calling the column method on the subclass instance for
81
81
  # a column not in the superclass table will cause a query to the database
82
- # to get the value for that column. If the subclass instance was retreived
82
+ # to get the value for that column. If the subclass instance was retrieved
83
83
  # using Dataset#all, the query to the database will attempt to load the column
84
84
  # values for all subclass instances that were retrieved. For example:
85
85
  #
@@ -1,8 +1,8 @@
1
1
  # frozen-string-literal: true
2
2
 
3
- # :nocov:
3
+ # simplecov:disable
4
4
  raise(Sequel::Error, "Sequel column_encryption plugin requires ruby 2.3 or greater") unless RUBY_VERSION >= '2.3'
5
- # :nocov:
5
+ # simplecov:enable
6
6
 
7
7
  require 'openssl'
8
8
 
@@ -22,13 +22,13 @@ begin
22
22
  cipher.key = '1'*32
23
23
  cipher.auth_data = ''
24
24
  cipher.auth_tag = auth_tag
25
- # :nocov:
25
+ # simplecov:disable
26
26
  unless (cipher.update(cipher_text) << cipher.final) == '2'
27
27
  raise OpenSSL::Cipher::CipherError
28
28
  end
29
29
  rescue RuntimeError, OpenSSL::Cipher::CipherError
30
30
  raise LoadError, "Sequel column_encryption plugin requires a working aes-256-gcm cipher"
31
- # :nocov:
31
+ # simplecov:enable
32
32
  end
33
33
 
34
34
  require 'securerandom'
@@ -279,7 +279,7 @@ module Sequel
279
279
  #
280
280
  # = Unsupported Features
281
281
  #
282
- # The following features are delibrately not supported:
282
+ # The following features are deliberately not supported:
283
283
  #
284
284
  # == Compression
285
285
  #
@@ -475,12 +475,12 @@ module Sequel
475
475
  def decode64(str)
476
476
  str.unpack1("m0")
477
477
  end
478
- # :nocov:
478
+ # simplecov:disable
479
479
  else
480
480
  def decode64(str)
481
481
  str.unpack("m0")[0]
482
482
  end
483
- # :nocov:
483
+ # simplecov:enable
484
484
  end
485
485
 
486
486
  def urlsafe_encode64(bin)
@@ -493,7 +493,7 @@ module Sequel
493
493
  decode64(str.tr("-_", "+/"))
494
494
  end
495
495
 
496
- # An array of strings, one for each configured encryption key, to find encypted values matching
496
+ # An array of strings, one for each configured encryption key, to find encrypted values matching
497
497
  # the given data and search format.
498
498
  def _search_prefixes(data, search_type)
499
499
  @key_map.map do |key_id, (key, _)|
@@ -610,7 +610,7 @@ module Sequel
610
610
  end
611
611
  end
612
612
 
613
- # This stores four callables for handling encyption, decryption, data searching,
613
+ # This stores four callables for handling encryption, decryption, data searching,
614
614
  # and key searching. One of these is created for each encrypted column.
615
615
  ColumnEncryptionMetadata = Struct.new(:encryptor, :decryptor, :data_searcher, :key_searcher) # :nodoc:
616
616
 
@@ -702,7 +702,7 @@ module Sequel
702
702
 
703
703
  module InstanceMethods
704
704
  # Reencrypt the model if needed. Looks at all of the models encrypted columns
705
- # and if any were encypted with older keys or a different format, reencrypt
705
+ # and if any were encrypted with older keys or a different format, reencrypt
706
706
  # with the current key and format and save the object. Returns the object
707
707
  # if reencryption was needed, or nil if reencryption was not needed.
708
708
  def reencrypt
@@ -69,8 +69,8 @@ module Sequel
69
69
  # To keep things simple, you can use +Sequel.synchronize_with+ to only
70
70
  # use this mutex if it is available. You want to use the mutex around the
71
71
  # code that initializes the associations (usually to +nil+ or <tt>[]</tt>),
72
- # and also around the code that sets the associatied objects appropriately
73
- # after they have been retreived. You do not want to use the mutex around
72
+ # and also around the code that sets the associated objects appropriately
73
+ # after they have been retrieved. You do not want to use the mutex around
74
74
  # the code that loads the objects, since that will prevent concurrent loading.
75
75
  # So after the changes, the custom eager loader would look like this:
76
76
  #
@@ -82,13 +82,13 @@ module Sequel
82
82
  end
83
83
  END
84
84
  else
85
- # :nocov:
85
+ # simplecov:disable
86
86
  # :nodoc:
87
87
  def self.csv_call(*args, opts, &block)
88
88
  CSV.send(*args, opts, &block)
89
89
  end
90
90
  # :nodoc:
91
- # :nocov:
91
+ # simplecov:enable
92
92
  end
93
93
 
94
94
  module ClassMethods
@@ -105,9 +105,9 @@ module Sequel
105
105
  end
106
106
  super(*a, &b)
107
107
  end
108
- # :nocov:
108
+ # simplecov:disable
109
109
  ruby2_keywords(name) if respond_to?(:ruby2_keywords, true)
110
- # :nocov:
110
+ # simplecov:enable
111
111
  alias_method(name, name)
112
112
  end
113
113
  end
@@ -77,7 +77,7 @@ module Sequel
77
77
 
78
78
  private
79
79
 
80
- # Wether to use all when each is called, true when eager loading
80
+ # Whether to use all when each is called, true when eager loading
81
81
  # unless the flag has already been set.
82
82
  def use_eager_all?
83
83
  (opts[:eager] || opts[:eager_graph]) && !opts[:all_called]