sequel 4.48.0 → 4.49.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +56 -0
  3. data/doc/advanced_associations.rdoc +1 -1
  4. data/doc/opening_databases.rdoc +3 -2
  5. data/doc/release_notes/4.49.0.txt +222 -0
  6. data/lib/sequel/adapters/ibmdb.rb +6 -1
  7. data/lib/sequel/adapters/jdbc.rb +3 -1
  8. data/lib/sequel/adapters/jdbc/h2.rb +10 -1
  9. data/lib/sequel/adapters/jdbc/postgresql.rb +3 -2
  10. data/lib/sequel/adapters/jdbc/sqlserver.rb +9 -2
  11. data/lib/sequel/adapters/mock.rb +3 -0
  12. data/lib/sequel/adapters/mysql2.rb +1 -1
  13. data/lib/sequel/adapters/postgres.rb +2 -1
  14. data/lib/sequel/adapters/shared/mysql.rb +4 -1
  15. data/lib/sequel/adapters/shared/oracle.rb +26 -3
  16. data/lib/sequel/connection_pool.rb +9 -2
  17. data/lib/sequel/connection_pool/sharded_single.rb +1 -1
  18. data/lib/sequel/connection_pool/sharded_threaded.rb +1 -1
  19. data/lib/sequel/connection_pool/single.rb +2 -2
  20. data/lib/sequel/connection_pool/threaded.rb +2 -2
  21. data/lib/sequel/database/connecting.rb +3 -3
  22. data/lib/sequel/database/dataset_defaults.rb +14 -1
  23. data/lib/sequel/dataset.rb +1 -1
  24. data/lib/sequel/dataset/actions.rb +54 -0
  25. data/lib/sequel/dataset/dataset_module.rb +58 -0
  26. data/lib/sequel/dataset/query.rb +3 -3
  27. data/lib/sequel/exceptions.rb +8 -0
  28. data/lib/sequel/extensions/_model_pg_row.rb +5 -2
  29. data/lib/sequel/extensions/current_datetime_timestamp.rb +2 -1
  30. data/lib/sequel/extensions/date_arithmetic.rb +1 -0
  31. data/lib/sequel/extensions/duplicate_columns_handler.rb +2 -2
  32. data/lib/sequel/extensions/migration.rb +5 -2
  33. data/lib/sequel/extensions/null_dataset.rb +1 -0
  34. data/lib/sequel/model/associations.rb +3 -0
  35. data/lib/sequel/model/base.rb +10 -55
  36. data/lib/sequel/model/dataset_module.rb +5 -43
  37. data/lib/sequel/model/errors.rb +2 -1
  38. data/lib/sequel/model/inflections.rb +17 -5
  39. data/lib/sequel/plugins/active_model.rb +2 -2
  40. data/lib/sequel/plugins/class_table_inheritance.rb +1 -0
  41. data/lib/sequel/plugins/composition.rb +2 -2
  42. data/lib/sequel/plugins/dataset_associations.rb +25 -13
  43. data/lib/sequel/plugins/json_serializer.rb +2 -2
  44. data/lib/sequel/plugins/pg_row.rb +4 -2
  45. data/lib/sequel/plugins/serialization.rb +1 -0
  46. data/lib/sequel/plugins/single_table_inheritance.rb +6 -1
  47. data/lib/sequel/plugins/touch.rb +2 -1
  48. data/lib/sequel/plugins/validation_helpers.rb +10 -2
  49. data/lib/sequel/sql.rb +16 -7
  50. data/lib/sequel/version.rb +1 -1
  51. data/spec/adapters/mssql_spec.rb +4 -4
  52. data/spec/adapters/mysql_spec.rb +5 -1
  53. data/spec/adapters/oracle_spec.rb +4 -0
  54. data/spec/bin_spec.rb +7 -1
  55. data/spec/core/connection_pool_spec.rb +28 -14
  56. data/spec/core/database_spec.rb +149 -0
  57. data/spec/core/dataset_spec.rb +173 -0
  58. data/spec/extensions/class_table_inheritance_spec.rb +58 -17
  59. data/spec/extensions/composition_spec.rb +13 -0
  60. data/spec/extensions/dataset_associations_spec.rb +12 -0
  61. data/spec/extensions/many_through_many_spec.rb +4 -4
  62. data/spec/extensions/null_dataset_spec.rb +1 -1
  63. data/spec/extensions/serialization_spec.rb +1 -1
  64. data/spec/extensions/single_table_inheritance_spec.rb +16 -0
  65. data/spec/extensions/validation_helpers_spec.rb +1 -2
  66. data/spec/integration/associations_test.rb +8 -0
  67. data/spec/integration/plugin_test.rb +8 -3
  68. data/spec/model/association_reflection_spec.rb +1 -1
  69. data/spec/model/associations_spec.rb +29 -9
  70. data/spec/model/class_dataset_methods_spec.rb +6 -0
  71. data/spec/model/eager_loading_spec.rb +8 -8
  72. data/spec/model/plugins_spec.rb +34 -0
  73. data/spec/model/record_spec.rb +1 -1
  74. data/spec/spec_config.rb +2 -0
  75. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b093264594c435f6dee3a24f2245dd8a84f3a739
4
- data.tar.gz: 92d8d17d4d092f86d8d20d015fa86da8422005b5
3
+ metadata.gz: 272cf6bec70bfd569e735839c6e7dce242527188
4
+ data.tar.gz: 8fac2b669b6d97264ef870f601a882a833d2abeb
5
5
  SHA512:
6
- metadata.gz: 451903d4f3abb15ce7395afdb6052ba9b60e30b895b413b8bdb74067dce03a6b748c2357a89a65eda6a6620d7dce85f007fba1be4b796954ff530d744c4b927b
7
- data.tar.gz: 003675d934cf08064143725513b42857aaffa99de6586a5a3bf57bb0f6d241428379a2bdc643de7eaf947c89cb4d1c2310c904e6697ad1b60023a85c6db9ec1d
6
+ metadata.gz: 5d1fffb914a7352c99aceb0d0ae222a36a6a48c3fef47aa9b10d1ffc494ae625e53f1f0435d009aa050e13fbf8e1296b6bb15110e19e1762bce0f8f77ce4621e
7
+ data.tar.gz: f79ce483f64c7fbf4df674c374e2bac0009b6f1b479b8bb6e008921dd08ae2b88b16226427b26ce7bb3241c96ad0c2bbb55c6b66202efe4fa01e8813662a644e
data/CHANGELOG CHANGED
@@ -1,3 +1,59 @@
1
+ === 4.49.0 (2017-08-01)
2
+
3
+ * Make dataset_associations plugin automatically alias tables when using many_through_many associations that join the same table multiple times (jeremyevans)
4
+
5
+ * Deprecate using a :pool_class Database that is not a class or a symbol for a supported pool class (jeremyevans)
6
+
7
+ * Deprecate :eager_loading_predicate_key association option and association reflection method (jeremyevans)
8
+
9
+ * Deprecate Model.serialized_columns in the serialization plugin (jeremyevans)
10
+
11
+ * Deprecate Model.cti_columns in the class_table_inheritance plugin (jeremyevans)
12
+
13
+ * Deprecate SQL::AliasedExpression#aliaz, use #alias instead (jeremyevans)
14
+
15
+ * Deprecate SQL::Function#f, use #name instead (jeremyevans)
16
+
17
+ * Deprecate treating cross join with conditions as inner join on MySQL (jeremyevans)
18
+
19
+ * Deprecate ConnectionPool#created_count, use #size instead (jeremyevans)
20
+
21
+ * Deprecate ConnectionPool::CONNECTION_POOL_MAP, use the :pool_class option to specify a non-default connection pool (jeremyevans)
22
+
23
+ * Deprecate Sequel::IBMDB::Connection#prepared_statements= in the ibmdb adapter (jeremyevans)
24
+
25
+ * Deprecate DEFAULT_OPTIONS in validation_helpers, override default_validation_helpers_options private method instead (jeremyevans)
26
+
27
+ * Deprecate model association before callbacks returning false to cancel the action (jeremyevans)
28
+
29
+ * Support native offset syntax on Oracle 12 (timon) (#1397)
30
+
31
+ * Deprecate Dataset#nullify! in the null_dataset extension (jeremyevans)
32
+
33
+ * Deprecate Dataset#autoid=, #_fetch=, and #numrows= in the mock adapter (jeremyevans)
34
+
35
+ * Deprecate loading plugins by requiring sequel_#{plugin} (jeremyevans)
36
+
37
+ * Add Model.sti_class_from_sti_key in the single_table_inheritance plugin to get the appropriate class to use (Aryk) (#1396)
38
+
39
+ * Make Sequel::Error#cause use #wrapped_exception if it exists on ruby 2.1+ (jeremyevans)
40
+
41
+ * Make Dataset#where_all, #where_each, #where_single_value core dataset methods instead of just model dataset methods (jeremyevans)
42
+
43
+ * Make Database#extend_datasets and Dataset#with_extend now use a Dataset::DatasetModule instance if given a block (jeremyevans)
44
+
45
+ * Add Sequel::Dataset::DatasetModule, now a superclass of Sequel::Model::DatasetModule (jeremyevans)
46
+
47
+ * Make composition plugin with :mapping option work correctly if Model#get_column_value is overridden (jeremyevans)
48
+
49
+ * Support Dataset#paged_each :stream => false option on mysql2 to disable streaming (Aryk) (#1395)
50
+
51
+ * Make datetimeoffset handling in the jdbc/sqlserver adapter work on more drivers (jeremyevans)
52
+
53
+ * Make alter_table add_primary_key work correctly on H2 1.4+ (jeremyevans)
54
+
55
+ * Support :sslrootcert Database option in the postgres adapter (dleavitt) (#1391)
56
+
1
57
  === 4.48.0 (2017-07-01)
2
58
 
3
59
  * Deprecate Model.<< (jeremyevans)
@@ -211,7 +211,7 @@ and the tracks eager loader looks like:
211
211
  Album.one_to_many :tracks, :eager_loader=>(proc do |eo_opts|
212
212
  eo_opts[:rows].each{|album| album.associations[:tracks] = []}
213
213
  id_map = eo_opts[:id_map]
214
- Track.where(:id=>id_map.keys).all do |tracks|
214
+ Track.where(:album_id=>id_map.keys).all do |track|
215
215
  if albums = id_map[track.album_id]
216
216
  albums.each do |album|
217
217
  album.associations[:tracks] << track
@@ -284,7 +284,7 @@ The following additional options are supported:
284
284
 
285
285
  === postgres
286
286
 
287
- Requires: pg (or postgres if pg is not available)
287
+ Requires: pg (or postgres-pr/postgres-compat if pg is not available)
288
288
 
289
289
  The Sequel postgres adapter works with the pg, postgres, and postgres-pr ruby libraries.
290
290
  The pg library is the best supported, as it supports real bound variables and prepared statements.
@@ -308,8 +308,9 @@ The following additional options are supported:
308
308
  :notice_receiver :: A proc that be called with the PGresult objects that have notice or warning messages.
309
309
  The default notice receiver just prints the messages to stderr, but this can be used
310
310
  to handle notice/warning messages differently. Only respected if using the pg library).
311
- :sslmode :: Set to 'disable', 'allow', 'prefer', 'require' to choose how to treat SSL (only
311
+ :sslmode :: Set to 'disable', 'allow', 'prefer', 'require', 'verify-ca', or 'verify-full' to choose how to treat SSL (only
312
312
  respected if using the pg library)
313
+ :sslrootcert :: Specify the path to the root SSL certificate to use.
313
314
  :search_path :: Set to the schema search_path. This can either be a single string containing the schemas
314
315
  separated by commas (for use via a URL: <tt>postgres:///?search_path=schema1,schema2</tt>), or it
315
316
  can be an array of strings (for use via an option:
@@ -0,0 +1,222 @@
1
+ = Forward Compatibility
2
+
3
+ Sequel 4.49.0 will be the last minor release of Sequel 4. While the
4
+ vast majority of backwards incompatible changes in Sequel 5 have
5
+ deprecation warnings in 4.49.0, there are a few changes that do
6
+ not. Here is a brief list of changes coming in Sequel 5 that
7
+ do not have deprecation warnings (note that this list may not be
8
+ exhaustive):
9
+
10
+ * The {before,after,around}_validation hooks will always be called
11
+ when saving, even if the validate: false option is used. This
12
+ will allow you to use the before_validation hook to make changes
13
+ to the model instance that are required before validation and
14
+ before saving even if not validating. Currently, you would have
15
+ to use both a before_save and before_validation hook, which would
16
+ both be run on normal instance saving.
17
+
18
+ * Getting values for newly created model instances after insertion
19
+ now happens before after_create is called, instead of after.
20
+ This behavior is currently available via the before_after_save
21
+ plugin, and and will become the default behavior.
22
+
23
+ * Sequel will now immediately attempt to the connect to the database
24
+ when a Database instance is created, in order to fail fast. This
25
+ behavior is currently available via the test: true option, and
26
+ will become the default behavior. You can force not testing the
27
+ connection by using the test: false option.
28
+
29
+ * The validates_unique method in the validation_helpers plugin will
30
+ now only check for uniqueness by default if the record is new or
31
+ one of the related columns has been modified by default. You can
32
+ use only_if_modified: false to force the uniqueness check.
33
+
34
+ * Database schema methods and schema generator methods will return
35
+ nil instead of some internal value.
36
+
37
+ * Many cases where Sequel uses send internally will be switched to
38
+ public_send so they only call public methods, unless it is
39
+ specifically expected that they will call private methods.
40
+
41
+ * Model association hooks will be nil instead of empty arrays by
42
+ default. They will only be arrays if that hook has been set for
43
+ the association.
44
+
45
+ * Internal uses of instance_eval with a block will be changed to
46
+ instance_exec. This will allow them to be used with lambdas that
47
+ take no arguments. Unfortunately, it will break the case where a
48
+ lambda is currently used that takes one argument.
49
+
50
+ * Most internal constants will be frozen, unless there is a
51
+ requirement that they be modified at runtime.
52
+
53
+ * The @was_new instance variable set during model instance creation
54
+ will be removed.
55
+
56
+ = Deprecated Features
57
+
58
+ * Model association before callbacks returning false canceling the
59
+ action is now deprecated. The callbacks should now call
60
+ Model#cancel_action to cancel the action.
61
+
62
+ * Loading plugins by requiring them via sequel_#{plugin} is now
63
+ deprecated. Affected plugins should move the plugin file so it can
64
+ be required via sequel/plugins/#{plugin}.
65
+
66
+ * In the mock adapter, Dataset#autoid=, #_fetch=, and #numrows= are
67
+ now deprecated. They modified the dataset itself, which would not
68
+ work for frozen datasets. Dataset#with_autoid, #with_fetch,
69
+ and #with_numrows should be used instead, which return a modified
70
+ copy.
71
+
72
+ * In the null_dataset extension, Dataset#nullify! is now deprecated.
73
+ It modified the dataset itself, which would not work for frozen
74
+ datasets. Dataset#nullify should be used instead, which returns a
75
+ modified copy.
76
+
77
+ * Modifying the validation_helpers plugin DEFAULT_OPTIONS hash is now
78
+ deprecated. Any change to the default options should be done by
79
+ overriding the Model#default_validation_helpers_options private
80
+ method.
81
+
82
+ * Modifying ConnectionPool::CONNECTION_POOL_MAP to support an
83
+ external connection pool is now deprecated. To use an external
84
+ connection pool, pass the pool class via the :pool_class
85
+ Database option. Additionally, using a :pool_class option that
86
+ is not a class or a symbol for one of the default connection
87
+ pools is also deprecated.
88
+
89
+ * ConnectionPool#created_count is now deprecated. This method was
90
+ misnamed, as it was in alias to size, but the name implies it
91
+ returns how many connections have been created, as opposed to how
92
+ many connections are still in the pool.
93
+
94
+ * Sequel::SQL::Function#f is now deprecated, switch to using #name
95
+ instead.
96
+
97
+ * Sequel::SQL::AliasedExpression#aliaz is now deprecated, switch
98
+ to using #alias instead.
99
+
100
+ * The :eager_loading_predicate_key association option and
101
+ eager_loading_predicate_key association method are now deprecated.
102
+ The predicate_key option and method should be used instead.
103
+
104
+ * The cti_columns class method in the class_table_inheritance plugin
105
+ is now deprecated.
106
+
107
+ * The serialized_columns class method in the serialization plugin
108
+ is now deprecated.
109
+
110
+ * Having ds.join_table(:table, :cross, :a=>:b) be treated as an
111
+ inner join on MySQL is now deprecated.
112
+
113
+ * Sequel::IBMDB::Connection#prepared_statements= in the ibmdb
114
+ adapter is now deprecated.
115
+
116
+ * Additional internal constants are now deprecated.
117
+
118
+ = New Features
119
+
120
+ * Database#extend_datasets and Database#with_extend if given a block
121
+ now use a Dataset::DatasetModule instance instead of a plain Module
122
+ instance. Dataset::DatasetModule is a subset of
123
+ Model::DatasetModule, and allows for the easy creation of dataset
124
+ methods that can perform caching for frozen datasets.
125
+
126
+ Defining dataset methods is done by calling methods with the same
127
+ name as dataset methods inside the extend_datasets or with_extend
128
+ block:
129
+
130
+ DB.extend_datasets do
131
+ order :by_id, :id
132
+ select :with_id_and_name, :id, :name
133
+ where :active, :active
134
+ end
135
+
136
+ This is equivalent to:
137
+
138
+ DB.extend_datasets do
139
+ def by_id
140
+ order(:id)
141
+ end
142
+
143
+ def with_id_and_name
144
+ select(:id, :name)
145
+ end
146
+
147
+ def active
148
+ where(:active)
149
+ end
150
+ end
151
+
152
+ Except that for frozen datasets (the default in Sequel 5),
153
+ code like:
154
+
155
+ 100.times do
156
+ DB[:table].active.with_id_and_name.by_id
157
+ end
158
+
159
+ will only allocate 4 datasets instead of 400, and can be
160
+ 3-4 times faster.
161
+
162
+ * Dataset#where_{all,each,single_value} are now core dataset methods
163
+ instead of just model dataset methods. These methods allow you to
164
+ replace:
165
+
166
+ dataset.where(cond).all
167
+ dataset.where(cond).each{}
168
+ dataset.where(cond).single_value
169
+
170
+ with:
171
+
172
+ dataset.where_all(cond)
173
+ dataset.where_each(cond){}
174
+ dataset.where_single_value(cond)
175
+
176
+ The advantage of #where_{all,each,single_value} is that frozen
177
+ datasets can take potentially advantage of caching and perform
178
+ 70%-300% faster.
179
+
180
+ * Oracle 12 native limit/offset support is now supported, which
181
+ in particular makes offset queries much faster as they don't
182
+ have to be emulated using the row_number window function.
183
+
184
+ * Dataset#paged_each in the mysql2 adapter now supports a
185
+ :stream=>false option to disable streaming and fallback to
186
+ the default implementation.
187
+
188
+ * The postgres adapter now supports the :sslrootcert option
189
+ directly, you no longer need to specify it using the
190
+ :driver_options hash.
191
+
192
+ * The single_table_inheritance plugin now supports an
193
+ sti_class_from_sti_key method for getting the appropriate
194
+ subclass for the given key.
195
+
196
+ = Other Improvements
197
+
198
+ * Using the dataset_associations plugin with a many_through_many
199
+ association that joins to the same table multiple times is now
200
+ handled correctly by automatically aliasing the table
201
+ appropriately.
202
+
203
+ * On Ruby 2.1+, Sequel::Error#cause will use wrapped_exception
204
+ if one is set. This doesn't result in different behavior in
205
+ most cases, but it can in cases where nested exception handling
206
+ is done and Sequel tries to raise the most relevant exception.
207
+
208
+ * Using the composition plugin with the :mapping option now works
209
+ correctly when using the column_conflicts plugin.
210
+
211
+ * The validation_helpers plugin's validates_max_length method
212
+ now correctly gets the default :nil_message option from
213
+ the default_validation_helpers_options method instead of
214
+ looking at the plugin defaults.
215
+
216
+ * The duplicate_columns_handler extension no longer makes the
217
+ Dataset#columns= method public.
218
+
219
+ * On H2 1.4+, alter_table add_primary_key now works correctly.
220
+
221
+ * The jdbc/sqlserver adapter's datetimeoffset type handling now
222
+ works with more JDBC driver versions.
@@ -37,7 +37,12 @@ module Sequel
37
37
  class Connection
38
38
  # A hash with prepared statement name symbol keys, where each value is
39
39
  # a two element array with an sql string and cached Statement value.
40
- attr_accessor :prepared_statements
40
+ attr_reader :prepared_statements
41
+
42
+ def prepared_statements=(v)
43
+ Sequel::Deprecation.deprecate("Sequel::IBMDB::Connection#prepared_statements=", "Use replace on the hash instead of reassigning it")
44
+ @prepared_statements = v
45
+ end
41
46
 
42
47
  # Error class for exceptions raised by the connection.
43
48
  class Error < StandardError
@@ -10,6 +10,7 @@ module Sequel
10
10
  module JavaLang
11
11
  include_package 'java.lang'
12
12
  end
13
+ Sequel::Deprecation.deprecate_constant(self, :JavaLang)
13
14
 
14
15
  # Make it accesing the java.sql hierarchy more ruby friendly.
15
16
  module JavaSQL
@@ -20,6 +21,7 @@ module Sequel
20
21
  module JavaxNaming
21
22
  include_package 'javax.naming'
22
23
  end
24
+ Sequel::Deprecation.deprecate_constant(self, :JavaxNaming)
23
25
 
24
26
  # Used to identify a jndi connection and to extract the jndi
25
27
  # resource name.
@@ -488,7 +490,7 @@ module Sequel
488
490
  # Gets the connection from JNDI.
489
491
  def get_connection_from_jndi
490
492
  jndi_name = JNDI_URI_REGEXP.match(uri)[1]
491
- JavaxNaming::InitialContext.new.lookup(jndi_name).connection
493
+ javax.naming.InitialContext.new.lookup(jndi_name).connection
492
494
  end
493
495
 
494
496
  # Gets the JDBC connection uri from the JNDI resource.
@@ -30,6 +30,15 @@ module Sequel
30
30
  :h2
31
31
  end
32
32
 
33
+ def freeze
34
+ h2_version
35
+ super
36
+ end
37
+
38
+ def h2_version
39
+ @h2_version ||= get(Sequel.function(:H2VERSION))
40
+ end
41
+
33
42
  # Rollback an existing prepared transaction with the given transaction
34
43
  # identifier string.
35
44
  def rollback_prepared_transaction(transaction_id, opts=OPTS)
@@ -84,7 +93,7 @@ module Sequel
84
93
 
85
94
  sqls = [super(table, op)]
86
95
 
87
- if pk && op[:type] != :identity
96
+ if pk && (h2_version >= '1.4' || op[:type] != :identity)
88
97
  sqls << "ALTER TABLE #{quote_schema_table(table)} ADD PRIMARY KEY (#{quote_identifier(op[:name])})"
89
98
  end
90
99
 
@@ -211,6 +211,8 @@ module Sequel
211
211
  include Sequel::Postgres::DatasetMethods
212
212
  APOS = "'".freeze
213
213
  Sequel::Deprecation.deprecate_constant(self, :APOS)
214
+ HSTORE_TYPE = 'hstore'.freeze
215
+ Sequel::Deprecation.deprecate_constant(self, :HSTORE_TYPE)
214
216
 
215
217
  private
216
218
 
@@ -228,7 +230,6 @@ module Sequel
228
230
  ARRAY_TYPE = Java::JavaSQL::Types::ARRAY
229
231
  ARRAY_METHOD = Postgres.method(:RubyPGArray)
230
232
  PG_SPECIFIC_TYPES = [ARRAY_TYPE, Java::JavaSQL::Types::OTHER, Java::JavaSQL::Types::STRUCT]#.freeze # SEQUEL5
231
- HSTORE_TYPE = 'hstore'.freeze
232
233
  HSTORE_METHOD = Postgres.method(:RubyPGHstore)
233
234
 
234
235
  def type_convertor(map, meta, type, i)
@@ -241,7 +242,7 @@ module Sequel
241
242
  ARRAY_METHOD
242
243
  elsif oid == 2950 # UUID
243
244
  map[STRING_TYPE]
244
- elsif meta.getPGType(i) == HSTORE_TYPE
245
+ elsif meta.getPGType(i) == 'hstore'
245
246
  HSTORE_METHOD
246
247
  else
247
248
  super
@@ -42,8 +42,15 @@ module Sequel
42
42
  super
43
43
  map = @type_convertor_map
44
44
  map[Java::JavaSQL::Types::TIME] = SQLServer.method(:MSSQLRubyTime)
45
- if defined?(Java::MicrosoftSql::Types::DATETIMEOFFSET)
46
- map[Java::MicrosoftSql::Types::DATETIMEOFFSET] = lambda do |r, i|
45
+
46
+ # Work around constant lazy loading in some drivers
47
+ begin
48
+ dto = Java::MicrosoftSql::Types::DATETIMEOFFSET
49
+ rescue NameError
50
+ end
51
+
52
+ if dto
53
+ map[dto] = lambda do |r, i|
47
54
  if v = r.getDateTimeOffset(i)
48
55
  to_application_timestamp(v.to_s)
49
56
  end
@@ -321,6 +321,7 @@ module Sequel
321
321
 
322
322
  # Override the databases's autoid setting for this dataset
323
323
  def autoid=(v)
324
+ Sequel::Deprecation.deprecate("Sequel::Mock::Dataset#autoid=", "Use with_autoid to return a modified dataset")
324
325
  cache_set(:_autoid, nil)
325
326
  @opts[:autoid] = v
326
327
  end
@@ -332,6 +333,7 @@ module Sequel
332
333
 
333
334
  # Override the databases's fetch setting for this dataset
334
335
  def _fetch=(v)
336
+ Sequel::Deprecation.deprecate("Sequel::Mock::Dataset#_fetch=", "Use with_fetch to return a modified dataset")
335
337
  cache_set(:_fetch, nil)
336
338
  @opts[:fetch] = v
337
339
  end
@@ -343,6 +345,7 @@ module Sequel
343
345
 
344
346
  # Override the databases's numrows setting for this dataset
345
347
  def numrows=(v)
348
+ Sequel::Deprecation.deprecate("Sequel::Mock::Dataset#_numrows=", "Use with_numrows to return a modified dataset")
346
349
  cache_set(:_numrows, nil)
347
350
  @opts[:numrows] = v
348
351
  end