sequel 4.44.0 → 4.45.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 (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +110 -0
  3. data/README.rdoc +8 -9
  4. data/doc/active_record.rdoc +2 -3
  5. data/doc/model_plugins.rdoc +1 -1
  6. data/doc/opening_databases.rdoc +0 -46
  7. data/doc/release_notes/4.45.0.txt +370 -0
  8. data/lib/sequel/adapters/cubrid.rb +2 -0
  9. data/lib/sequel/adapters/do.rb +2 -0
  10. data/lib/sequel/adapters/jdbc/as400.rb +2 -0
  11. data/lib/sequel/adapters/jdbc/cubrid.rb +2 -0
  12. data/lib/sequel/adapters/jdbc/firebirdsql.rb +2 -0
  13. data/lib/sequel/adapters/jdbc/informix-sqli.rb +2 -0
  14. data/lib/sequel/adapters/jdbc/jdbcprogress.rb +2 -0
  15. data/lib/sequel/adapters/jdbc/mysql.rb +1 -0
  16. data/lib/sequel/adapters/jdbc/postgresql.rb +5 -0
  17. data/lib/sequel/adapters/mysql.rb +1 -0
  18. data/lib/sequel/adapters/mysql2.rb +1 -0
  19. data/lib/sequel/adapters/odbc/oracle.rb +11 -0
  20. data/lib/sequel/adapters/odbc/progress.rb +2 -0
  21. data/lib/sequel/adapters/postgres.rb +0 -2
  22. data/lib/sequel/adapters/shared/cubrid.rb +2 -0
  23. data/lib/sequel/adapters/shared/firebird.rb +2 -0
  24. data/lib/sequel/adapters/shared/informix.rb +2 -0
  25. data/lib/sequel/adapters/shared/mssql.rb +47 -7
  26. data/lib/sequel/adapters/shared/mysql.rb +16 -1
  27. data/lib/sequel/adapters/shared/postgres.rb +9 -1
  28. data/lib/sequel/adapters/shared/progress.rb +2 -0
  29. data/lib/sequel/adapters/shared/sqlanywhere.rb +1 -1
  30. data/lib/sequel/adapters/swift.rb +2 -0
  31. data/lib/sequel/ast_transformer.rb +13 -6
  32. data/lib/sequel/core.rb +13 -16
  33. data/lib/sequel/database/connecting.rb +25 -10
  34. data/lib/sequel/database/dataset.rb +6 -1
  35. data/lib/sequel/database/dataset_defaults.rb +9 -2
  36. data/lib/sequel/database/misc.rb +10 -3
  37. data/lib/sequel/database/schema_methods.rb +4 -0
  38. data/lib/sequel/dataset/mutation.rb +8 -20
  39. data/lib/sequel/dataset/prepared_statements.rb +2 -0
  40. data/lib/sequel/dataset/query.rb +32 -7
  41. data/lib/sequel/dataset/sql.rb +13 -3
  42. data/lib/sequel/deprecated.rb +9 -1
  43. data/lib/sequel/exceptions.rb +37 -8
  44. data/lib/sequel/extensions/_deprecated_identifier_mangling.rb +117 -0
  45. data/lib/sequel/extensions/date_arithmetic.rb +1 -0
  46. data/lib/sequel/extensions/identifier_mangling.rb +3 -2
  47. data/lib/sequel/extensions/pg_hstore.rb +1 -5
  48. data/lib/sequel/extensions/schema_dumper.rb +3 -1
  49. data/lib/sequel/extensions/sequel_3_dataset_methods.rb +2 -2
  50. data/lib/sequel/extensions/string_agg.rb +1 -0
  51. data/lib/sequel/model.rb +23 -10
  52. data/lib/sequel/model/associations.rb +17 -5
  53. data/lib/sequel/model/base.rb +115 -62
  54. data/lib/sequel/model/dataset_module.rb +10 -3
  55. data/lib/sequel/model/exceptions.rb +7 -5
  56. data/lib/sequel/plugins/association_pks.rb +13 -1
  57. data/lib/sequel/plugins/association_proxies.rb +8 -1
  58. data/lib/sequel/plugins/before_after_save.rb +1 -0
  59. data/lib/sequel/plugins/class_table_inheritance.rb +7 -3
  60. data/lib/sequel/plugins/columns_updated.rb +42 -0
  61. data/lib/sequel/plugins/composition.rb +10 -5
  62. data/lib/sequel/plugins/error_splitter.rb +1 -1
  63. data/lib/sequel/plugins/hook_class_methods.rb +39 -5
  64. data/lib/sequel/plugins/instance_hooks.rb +58 -5
  65. data/lib/sequel/plugins/lazy_attributes.rb +10 -5
  66. data/lib/sequel/plugins/nested_attributes.rb +10 -5
  67. data/lib/sequel/plugins/prepared_statements.rb +7 -0
  68. data/lib/sequel/plugins/prepared_statements_associations.rb +2 -0
  69. data/lib/sequel/plugins/prepared_statements_with_pk.rb +2 -0
  70. data/lib/sequel/plugins/schema.rb +2 -0
  71. data/lib/sequel/plugins/scissors.rb +2 -0
  72. data/lib/sequel/plugins/serialization.rb +10 -5
  73. data/lib/sequel/plugins/split_values.rb +5 -1
  74. data/lib/sequel/plugins/static_cache.rb +2 -2
  75. data/lib/sequel/plugins/tactical_eager_loading.rb +1 -1
  76. data/lib/sequel/plugins/validation_contexts.rb +49 -0
  77. data/lib/sequel/plugins/validation_helpers.rb +1 -0
  78. data/lib/sequel/sql.rb +1 -1
  79. data/lib/sequel/version.rb +1 -1
  80. data/spec/adapters/mssql_spec.rb +31 -0
  81. data/spec/adapters/mysql_spec.rb +20 -2
  82. data/spec/adapters/postgres_spec.rb +43 -12
  83. data/spec/adapters/spec_helper.rb +5 -8
  84. data/spec/core/database_spec.rb +47 -12
  85. data/spec/core/dataset_mutation_spec.rb +22 -22
  86. data/spec/core/dataset_spec.rb +88 -20
  87. data/spec/core/deprecated_spec.rb +1 -1
  88. data/spec/core/expression_filters_spec.rb +1 -1
  89. data/spec/core/mock_adapter_spec.rb +0 -3
  90. data/spec/core/placeholder_literalizer_spec.rb +1 -1
  91. data/spec/core/schema_spec.rb +8 -1
  92. data/spec/core/spec_helper.rb +6 -1
  93. data/spec/core_extensions_spec.rb +4 -0
  94. data/spec/deprecation_helper.rb +17 -0
  95. data/spec/extensions/_deprecated_identifier_mangling_spec.rb +314 -0
  96. data/spec/extensions/association_pks_spec.rb +61 -13
  97. data/spec/extensions/association_proxies_spec.rb +3 -3
  98. data/spec/extensions/class_table_inheritance_spec.rb +39 -0
  99. data/spec/extensions/columns_updated_spec.rb +35 -0
  100. data/spec/extensions/composition_spec.rb +6 -1
  101. data/spec/extensions/hook_class_methods_spec.rb +114 -26
  102. data/spec/extensions/identifier_mangling_spec.rb +107 -73
  103. data/spec/extensions/instance_hooks_spec.rb +78 -14
  104. data/spec/extensions/lazy_attributes_spec.rb +8 -2
  105. data/spec/extensions/many_through_many_spec.rb +2 -2
  106. data/spec/extensions/mssql_optimistic_locking_spec.rb +1 -1
  107. data/spec/extensions/nested_attributes_spec.rb +8 -2
  108. data/spec/extensions/pg_array_spec.rb +18 -4
  109. data/spec/extensions/prepared_statements_associations_spec.rb +48 -39
  110. data/spec/extensions/prepared_statements_with_pk_spec.rb +13 -11
  111. data/spec/extensions/query_spec.rb +1 -1
  112. data/spec/extensions/schema_dumper_spec.rb +34 -6
  113. data/spec/extensions/schema_spec.rb +13 -7
  114. data/spec/extensions/scissors_spec.rb +3 -1
  115. data/spec/extensions/sequel_3_dataset_methods_spec.rb +4 -4
  116. data/spec/extensions/serialization_spec.rb +7 -1
  117. data/spec/extensions/set_overrides_spec.rb +2 -2
  118. data/spec/extensions/shared_caching_spec.rb +19 -15
  119. data/spec/extensions/spec_helper.rb +7 -3
  120. data/spec/extensions/split_values_spec.rb +45 -10
  121. data/spec/extensions/string_agg_spec.rb +2 -2
  122. data/spec/extensions/subset_conditions_spec.rb +3 -3
  123. data/spec/extensions/tactical_eager_loading_spec.rb +1 -1
  124. data/spec/extensions/validation_contexts_spec.rb +31 -0
  125. data/spec/guards_helper.rb +2 -0
  126. data/spec/integration/associations_test.rb +22 -20
  127. data/spec/integration/dataset_test.rb +25 -2
  128. data/spec/integration/model_test.rb +1 -1
  129. data/spec/integration/plugin_test.rb +11 -16
  130. data/spec/integration/prepared_statement_test.rb +40 -32
  131. data/spec/integration/spec_helper.rb +5 -8
  132. data/spec/model/association_reflection_spec.rb +4 -0
  133. data/spec/model/associations_spec.rb +37 -10
  134. data/spec/model/base_spec.rb +6 -0
  135. data/spec/model/hooks_spec.rb +56 -35
  136. data/spec/model/model_spec.rb +21 -5
  137. data/spec/model/record_spec.rb +14 -11
  138. data/spec/model/spec_helper.rb +7 -1
  139. data/spec/sequel_warning.rb +11 -0
  140. metadata +13 -3
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ #SEQUEL5: Remove
4
+
3
5
  require 'cubrid'
4
6
  Sequel.require 'adapters/shared/cubrid'
5
7
 
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ Sequel::Deprecation.deprecate("The do (DataObjects) adapter", "Please consider maintaining it yourself as an external gem if you want to continue using it")
4
+
3
5
  require 'data_objects'
4
6
 
5
7
  module Sequel
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ Sequel::Deprecation.deprecate("The jdbc/as400 adapter", "Please consider maintaining it yourself as an external gem if you want to continue using it")
4
+
3
5
  Sequel::JDBC.load_driver('com.ibm.as400.access.AS400JDBCDriver')
4
6
  Sequel.require 'adapters/jdbc/transactions'
5
7
  Sequel.require 'adapters/utils/emulate_offset_with_row_number'
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ #SEQUEL5: Remove
4
+
3
5
  Sequel::JDBC.load_driver('Java::cubrid.jdbc.driver.CUBRIDDriver')
4
6
  Sequel.require 'adapters/shared/cubrid'
5
7
  Sequel.require 'adapters/jdbc/transactions'
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ #SEQUEL5: Remove
4
+
3
5
  Sequel::JDBC.load_driver('org.firebirdsql.jdbc.FBDriver')
4
6
  Sequel.require 'adapters/shared/firebird'
5
7
  Sequel.require 'adapters/jdbc/transactions'
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ #SEQUEL5: Remove
4
+
3
5
  Sequel::JDBC.load_driver('com.informix.jdbc.IfxDriver')
4
6
  Sequel.require 'adapters/shared/informix'
5
7
 
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ #SEQUEL5: Remove
4
+
3
5
  Sequel::JDBC.load_driver('com.progress.sql.jdbc.JdbcProgressDriver')
4
6
  Sequel.require 'adapters/shared/progress'
5
7
  Sequel.require 'adapters/jdbc/transactions'
@@ -27,6 +27,7 @@ module Sequel
27
27
  # of the connection string, since the JDBC does no parsing on the
28
28
  # given connection string by default.
29
29
  def database_name
30
+ Sequel::Deprecation.deprecate("Database#database_name", "Instead, use .get{DATABASE{}}")
30
31
  u = URI.parse(uri.sub(/\Ajdbc:/, ''))
31
32
  (m = /\/(.*)/.match(u.path)) && m[1]
32
33
  end
@@ -195,6 +195,11 @@ module Sequel
195
195
  sql << APOS << db.synchronize(@opts[:server]){|c| c.escape_string(v)} << APOS
196
196
  end
197
197
 
198
+ # SQL fragment for Sequel::SQLTime, containing just the time part
199
+ def literal_sqltime(v)
200
+ v.strftime("'%H:%M:%S#{sprintf(".%03d", (v.usec/1000.0).round)}'")
201
+ end
202
+
198
203
  STRING_TYPE = Java::JavaSQL::Types::VARCHAR
199
204
  ARRAY_TYPE = Java::JavaSQL::Types::ARRAY
200
205
  PG_SPECIFIC_TYPES = [ARRAY_TYPE, Java::JavaSQL::Types::OTHER, Java::JavaSQL::Types::STRUCT]
@@ -282,6 +282,7 @@ module Sequel
282
282
  # The database name when using the native adapter is always stored in
283
283
  # the :database option.
284
284
  def database_name
285
+ Sequel::Deprecation.deprecate("Database#database_name", "Instead, use .get{DATABASE{}}")
285
286
  @opts[:database]
286
287
  end
287
288
 
@@ -218,6 +218,7 @@ module Sequel
218
218
  # The database name when using the native adapter is always stored in
219
219
  # the :database option.
220
220
  def database_name
221
+ Sequel::Deprecation.deprecate("Database#database_name", "Instead, use .get{DATABASE{}}")
221
222
  @opts[:database]
222
223
  end
223
224
 
@@ -0,0 +1,11 @@
1
+ # frozen-string-literal: true
2
+
3
+ Sequel.require 'adapters/shared/oracle'
4
+
5
+ Sequel.synchronize do
6
+ Sequel::ODBC::DATABASE_SETUP[:oracle] = proc do |db|
7
+ db.extend ::Sequel::Oracle::DatabaseMethods
8
+ db.extend_datasets ::Sequel::Oracle::DatasetMethods
9
+ end
10
+ end
11
+
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ #SEQUEL5: Remove
4
+
3
5
  Sequel.require 'adapters/shared/progress'
4
6
 
5
7
  Sequel.synchronize do
@@ -141,8 +141,6 @@ module Sequel
141
141
  # errors.
142
142
  DISCONNECT_ERROR_RE = /\A#{Regexp.union(disconnect_errors)}/
143
143
 
144
- self.translate_results = false if respond_to?(:translate_results=)
145
-
146
144
  # Hash of prepared statements for this connection. Keys are
147
145
  # string names of the server side prepared statement, and values
148
146
  # are SQL strings.
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ Sequel::Deprecation.deprecate("Sequel support for Cubrid", "Please consider maintaining it yourself as an external sequel adapter if you want to continue using it")
4
+
3
5
  Sequel.require %w'split_alter_table unmodified_identifiers', 'adapters/utils'
4
6
 
5
7
  module Sequel
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ Sequel::Deprecation.deprecate("Sequel support for Firebird", "Please consider maintaining it yourself as an external sequel adapter if you want to continue using it")
4
+
3
5
  module Sequel
4
6
  module Firebird
5
7
  Sequel::Database.set_shared_adapter_scheme(:firebird, self)
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ Sequel::Deprecation.deprecate("Sequel support for Informix", "Please consider maintaining it yourself as an external sequel adapter if you want to continue using it")
4
+
3
5
  module Sequel
4
6
  module Informix
5
7
  Sequel::Database.set_shared_adapter_scheme(:informix, self)
@@ -525,7 +525,7 @@ module Sequel
525
525
 
526
526
  module DatasetMethods
527
527
  include(Module.new do
528
- Dataset.def_sql_method(self, :select, %w'with select distinct limit columns into from lock join where group having order compounds')
528
+ Dataset.def_sql_method(self, :select, %w'with select distinct limit columns into from lock join where group having compounds order')
529
529
  end)
530
530
  include EmulateOffsetWithRowNumber
531
531
 
@@ -576,9 +576,10 @@ module Sequel
576
576
  FETCH_NEXT = " FETCH NEXT ".freeze
577
577
 
578
578
  NON_SQL_OPTIONS = (Dataset::NON_SQL_OPTIONS + [:disable_insert_output, :mssql_unicode_strings]).freeze
579
+ LIMIT_ALL = Object.new.freeze
579
580
 
580
581
  Dataset.def_mutation_method(:disable_insert_output, :output, :module=>self)
581
- Dataset.def_sql_method(self, :delete, %w'with delete from output from2 where')
582
+ Dataset.def_sql_method(self, :delete, %w'with delete limit from output from2 where')
582
583
  Dataset.def_sql_method(self, :insert, %w'with insert into columns output values')
583
584
  Dataset.def_sql_method(self, :update, [['if is_2005_or_later?', %w'with update limit table set output from where'], ['else', %w'update table set output from where']])
584
585
 
@@ -847,8 +848,34 @@ module Sequel
847
848
  (options_overlap(Sequel::Dataset::COUNT_FROM_SELF_OPTS) && !options_overlap([:limit])) ? unordered.from_self : super
848
849
  end
849
850
 
851
+ # If the dataset using a order without a limit or offset or custom SQL,
852
+ # remove the order. Compounds on Microsoft SQL Server have undefined
853
+ # order unless the result is specifically ordered. Applying the current
854
+ # order before the compound doesn't work in all cases, such as when
855
+ # qualified identifiers are used. If you want to ensure a order
856
+ # for a compound dataset, apply the order after all compounds have been
857
+ # added.
858
+ def compound_from_self
859
+ if @opts[:offset] && !@opts[:limit] && !is_2012_or_later?
860
+ clone(:limit=>LIMIT_ALL).from_self
861
+ elsif @opts[:order] && !(@opts[:sql] || @opts[:limit] || @opts[:offset])
862
+ unordered
863
+ else
864
+ super
865
+ end
866
+ end
867
+
850
868
  private
851
869
 
870
+ # Allow update and delete for unordered, limited datasets only.
871
+ def check_not_limited!(type)
872
+ return if @opts[:skip_limit_check] && type != :truncate
873
+ #SEQUEL5
874
+ #raise Sequel::InvalidOperation, "Dataset##{type} not suppored on ordered, limited datasets" if opts[:order] && opts[:limit]
875
+ Sequel::Deprecation.deprecate("Dataset##{type} on ordered, limited datasets", "Call unlimited to not use a limit, or unordered to not use an order, or skip_limit_check to ignore the limit") if @opts[:order] && @opts[:limit]
876
+ super if type == :truncate || @opts[:offset]
877
+ end
878
+
852
879
  # Whether we are using SQL Server 2005 or later.
853
880
  def is_2005_or_later?
854
881
  server_version >= 9000000
@@ -986,18 +1013,31 @@ module Sequel
986
1013
  def select_limit_sql(sql)
987
1014
  if l = @opts[:limit]
988
1015
  return if is_2012_or_later? && @opts[:order] && @opts[:offset]
1016
+ shared_limit_sql(sql, l)
1017
+ end
1018
+ end
989
1019
 
990
- if is_2005_or_later?
1020
+ def shared_limit_sql(sql, l)
1021
+ if is_2005_or_later?
1022
+ if l == LIMIT_ALL
1023
+ sql << " TOP (100) PERCENT"
1024
+ else
991
1025
  sql << TOP_PAREN
992
1026
  literal_append(sql, l)
993
1027
  sql << PAREN_CLOSE
994
- else
995
- sql << TOP
996
- literal_append(sql, l)
997
1028
  end
1029
+ else
1030
+ sql << TOP
1031
+ literal_append(sql, l)
1032
+ end
1033
+ end
1034
+
1035
+ def update_limit_sql(sql)
1036
+ if l = @opts[:limit]
1037
+ shared_limit_sql(sql, l)
998
1038
  end
999
1039
  end
1000
- alias update_limit_sql select_limit_sql
1040
+ alias delete_limit_sql update_limit_sql
1001
1041
 
1002
1042
  # Support different types of locking styles
1003
1043
  def select_lock_sql(sql)
@@ -110,7 +110,16 @@ module Sequel
110
110
  remove_indexes = []
111
111
  m = output_identifier_meth
112
112
  im = input_identifier_meth
113
- metadata_dataset.with_sql("SHOW INDEX FROM ?", SQL::Identifier.new(im.call(table))).each do |r|
113
+ schema, table = schema_and_table(table)
114
+
115
+ table = Sequel::SQL::Identifier.new(table)
116
+ sql = "SHOW INDEX FROM #{literal(table)}"
117
+ if schema
118
+ schema = Sequel::SQL::Identifier.new(schema)
119
+ sql += " FROM #{literal(schema)}"
120
+ end
121
+
122
+ metadata_dataset.with_sql(sql).each do |r|
114
123
  name = r[:Key_name]
115
124
  next if name == PRIMARY
116
125
  name = m.call(name)
@@ -181,6 +190,7 @@ module Sequel
181
190
  # Changes the database in use by issuing a USE statement. I would be
182
191
  # very careful if I used this.
183
192
  def use(db_name)
193
+ Sequel::Deprecation.deprecate("Database#use", "Create a new Sequel::Database instance instead of using Database#use")
184
194
  disconnect
185
195
  @opts[:database] = db_name if self << "USE #{db_name}"
186
196
  @schemas = {}
@@ -862,6 +872,11 @@ module Sequel
862
872
 
863
873
  private
864
874
 
875
+ # Allow update and delete for limited datasets, unless there is an offset.
876
+ def check_not_limited!(type)
877
+ super if type == :truncate || @opts[:offset]
878
+ end
879
+
865
880
  # Consider the first table in the joined dataset is the table to delete
866
881
  # from, but include the others for the purposes of selecting rows.
867
882
  def delete_from_sql(sql)
@@ -182,7 +182,12 @@ module Sequel
182
182
  # a block is given, it is used as the conversion proc, otherwise
183
183
  # the conversion proc is looked up in the PG_NAMED_TYPES hash.
184
184
  def add_named_conversion_proc(name, &block)
185
- add_named_conversion_procs(conversion_procs, name=>(block || PG_NAMED_TYPES[name]))
185
+ unless block
186
+ if block = PG_NAMED_TYPES[name]
187
+ Sequel::Deprecation.deprecate("Sequel::PG_NAMED_TYPES", "Call Database#add_named_conversion_proc directly for each database you want to support the #{name} type")
188
+ end
189
+ end
190
+ add_named_conversion_procs(conversion_procs, name=>block)
186
191
  end
187
192
 
188
193
  # Commit an existing prepared transaction with the given transaction
@@ -1009,6 +1014,9 @@ module Sequel
1009
1014
  def get_conversion_procs
1010
1015
  procs = PG_TYPES.dup
1011
1016
  procs[1184] = procs[1114] = method(:to_application_timestamp)
1017
+ unless PG_NAMED_TYPES.empty?
1018
+ Sequel::Deprecation.deprecate("Sequel::PG_NAMED_TYPES", "Call Database#add_named_conversion_proc directly for each Database instance where you want to support the following type(s): #{PG_NAMED_TYPES.keys.join(', ')}")
1019
+ end
1012
1020
  add_named_conversion_procs(procs, PG_NAMED_TYPES)
1013
1021
  procs
1014
1022
  end
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ Sequel::Deprecation.deprecate("Sequel support for Progress", "Please consider maintaining it yourself as an external sequel adapter if you want to continue using it")
4
+
3
5
  module Sequel
4
6
  module Progress
5
7
  module DatabaseMethods
@@ -289,7 +289,7 @@ module Sequel
289
289
  ONLY_OFFSET = " TOP 2147483647".freeze
290
290
 
291
291
  Dataset.def_sql_method(self, :insert, %w'with insert into columns values')
292
- Dataset.def_sql_method(self, :select, %w'with select distinct limit columns into from join where group having order compounds lock')
292
+ Dataset.def_sql_method(self, :select, %w'with select distinct limit columns into from join where group having compounds order lock')
293
293
 
294
294
  # Whether to convert smallint to boolean arguments for this dataset.
295
295
  # Defaults to the SqlAnywhere module setting.
@@ -1,5 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
+ Sequel::Deprecation.deprecate("The swift adapter", "Please consider maintaining it yourself as an external gem if you want to continue using it")
4
+
3
5
  module Sequel
4
6
  # Module holding the Swift DB support for Sequel. Swift DB is a
5
7
  # collection of drivers used in Swift ORM.
@@ -89,11 +89,16 @@ module Sequel
89
89
  # Handles qualifying existing datasets, so that unqualified columns
90
90
  # in the dataset are qualified with a given table name.
91
91
  class Qualifier < ASTTransformer
92
- # Store the dataset to use as the basis for qualification,
93
- # and the table used to qualify unqualified columns.
94
- def initialize(ds, table)
95
- @ds = ds
96
- @table = table
92
+ # Set the table used to qualify unqualified columns
93
+ def initialize(table, unused=nil)
94
+ if unused
95
+ # :nocov:
96
+ Sequel::Deprecation.deprecate("Passing two arguments to Sequel::Qualifier.new", 'Pass only the second arguument specifying the table used for qualification')
97
+ @table = unused
98
+ # :nocov:
99
+ else
100
+ @table = table
101
+ end
97
102
  end
98
103
 
99
104
  private
@@ -105,7 +110,7 @@ module Sequel
105
110
  def v(o)
106
111
  case o
107
112
  when Symbol
108
- t, column, aliaz = @ds.send(:split_symbol, o)
113
+ t, column, aliaz = Sequel.split_symbol(o)
109
114
  if t
110
115
  o
111
116
  elsif aliaz
@@ -160,6 +165,7 @@ module Sequel
160
165
 
161
166
  # Intialize an empty +binds+ hash.
162
167
  def initialize
168
+ Sequel::Deprecation.deprecate("Sequel::Unbinder", 'There is no replacement')
163
169
  @binds = {}
164
170
  end
165
171
 
@@ -205,4 +211,5 @@ module Sequel
205
211
  end
206
212
  end
207
213
  end
214
+ Sequel::Deprecation.deprecate_constant(self, :Unbinder)
208
215
  end
data/lib/sequel/core.rb CHANGED
@@ -25,8 +25,6 @@ module Sequel
25
25
  @convert_two_digit_years = true
26
26
  @datetime_class = Time
27
27
  @split_symbols = true
28
-
29
- # Whether Sequel is being run in single threaded mode
30
28
  @single_threaded = false
31
29
 
32
30
  class << self
@@ -51,6 +49,15 @@ module Sequel
51
49
  # they often implement them differently (e.g. + using seconds on +Time+ and
52
50
  # days on +DateTime+).
53
51
  attr_accessor :datetime_class
52
+
53
+ # Set whether sequel is being used in single threaded mode. by default,
54
+ # Sequel uses a thread-safe connection pool, which isn't as fast as the
55
+ # single threaded connection pool, and also has some additional thread
56
+ # safety checks. If your program will only have one thread,
57
+ # and speed is a priority, you should set this to true:
58
+ #
59
+ # Sequel.single_threaded = true
60
+ attr_accessor :single_threaded
54
61
  end
55
62
 
56
63
  # Returns true if the passed object could be a specifier of conditions, false otherwise.
@@ -152,6 +159,7 @@ module Sequel
152
159
  #
153
160
  # Other String instance methods work as well.
154
161
  def self.identifier_input_method=(value)
162
+ # SEQUEL5: Remove
155
163
  Database.identifier_input_method = value
156
164
  end
157
165
 
@@ -168,6 +176,7 @@ module Sequel
168
176
  #
169
177
  # Other String instance methods work as well.
170
178
  def self.identifier_output_method=(value)
179
+ # SEQUEL5: Remove
171
180
  Database.identifier_output_method = value
172
181
  end
173
182
 
@@ -194,6 +203,7 @@ module Sequel
194
203
  #
195
204
  # Sequel.quote_identifiers = false
196
205
  def self.quote_identifiers=(value)
206
+ # SEQUEL5: Remove
197
207
  Database.quote_identifiers = value
198
208
  end
199
209
 
@@ -218,18 +228,6 @@ module Sequel
218
228
  Array(files).each{|f| super("#{File.dirname(__FILE__).untaint}/#{"#{subdir}/" if subdir}#{f}")}
219
229
  end
220
230
 
221
- # Set whether Sequel is being used in single threaded mode. By default,
222
- # Sequel uses a thread-safe connection pool, which isn't as fast as the
223
- # single threaded connection pool, and also has some additional thread
224
- # safety checks. If your program will only have one thread,
225
- # and speed is a priority, you should set this to true:
226
- #
227
- # Sequel.single_threaded = true
228
- def self.single_threaded=(value)
229
- @single_threaded = value
230
- Database.single_threaded = value
231
- end
232
-
233
231
  COLUMN_REF_RE1 = /\A((?:(?!__).)+)__((?:(?!___).)+)___(.+)\z/.freeze
234
232
  COLUMN_REF_RE2 = /\A((?:(?!___).)+)___(.+)\z/.freeze
235
233
  COLUMN_REF_RE3 = /\A((?:(?!__).)+)__(.+)\z/.freeze
@@ -358,14 +356,13 @@ module Sequel
358
356
 
359
357
  # Uses a transaction on all given databases with the given options. This:
360
358
  #
361
- # Sequel.transaction([DB1, DB2, DB3]){...}
359
+ # Sequel.transaction([DB1, DB2, DB3]){}
362
360
  #
363
361
  # is equivalent to:
364
362
  #
365
363
  # DB1.transaction do
366
364
  # DB2.transaction do
367
365
  # DB3.transaction do
368
- # ...
369
366
  # end
370
367
  # end
371
368
  # end