sequel 5.6.0 → 5.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +30 -5099
  3. data/Rakefile +1 -1
  4. data/doc/opening_databases.rdoc +0 -2
  5. data/doc/postgresql.rdoc +31 -0
  6. data/doc/querying.rdoc +2 -2
  7. data/doc/release_notes/5.7.0.txt +108 -0
  8. data/doc/testing.rdoc +1 -0
  9. data/lib/sequel/adapters/jdbc/derby.rb +1 -1
  10. data/lib/sequel/adapters/jdbc/oracle.rb +11 -0
  11. data/lib/sequel/adapters/postgres.rb +1 -0
  12. data/lib/sequel/adapters/shared/postgres.rb +117 -13
  13. data/lib/sequel/connection_pool/sharded_threaded.rb +7 -6
  14. data/lib/sequel/connection_pool/threaded.rb +6 -6
  15. data/lib/sequel/core.rb +20 -0
  16. data/lib/sequel/database/logging.rb +3 -2
  17. data/lib/sequel/database/schema_generator.rb +1 -2
  18. data/lib/sequel/dataset/actions.rb +15 -5
  19. data/lib/sequel/extensions/connection_expiration.rb +3 -3
  20. data/lib/sequel/extensions/connection_validator.rb +3 -3
  21. data/lib/sequel/extensions/integer64.rb +30 -0
  22. data/lib/sequel/extensions/migration.rb +2 -3
  23. data/lib/sequel/plugins/pg_array_associations.rb +5 -3
  24. data/lib/sequel/plugins/validate_associated.rb +18 -0
  25. data/lib/sequel/version.rb +1 -1
  26. data/spec/adapters/mssql_spec.rb +6 -6
  27. data/spec/adapters/mysql_spec.rb +1 -1
  28. data/spec/adapters/oracle_spec.rb +15 -1
  29. data/spec/adapters/postgres_spec.rb +78 -1
  30. data/spec/adapters/spec_helper.rb +3 -1
  31. data/spec/bin_spec.rb +1 -0
  32. data/spec/core/dataset_spec.rb +10 -0
  33. data/spec/extensions/integer64_spec.rb +22 -0
  34. data/spec/extensions/pg_array_associations_spec.rb +14 -2
  35. data/spec/extensions/spec_helper.rb +1 -0
  36. data/spec/integration/associations_test.rb +4 -4
  37. data/spec/integration/dataset_test.rb +2 -0
  38. data/spec/integration/spec_helper.rb +5 -11
  39. data/spec/model/spec_helper.rb +1 -0
  40. metadata +35 -165
  41. data/doc/release_notes/1.0.txt +0 -38
  42. data/doc/release_notes/1.1.txt +0 -143
  43. data/doc/release_notes/1.3.txt +0 -101
  44. data/doc/release_notes/1.4.0.txt +0 -53
  45. data/doc/release_notes/1.5.0.txt +0 -155
  46. data/doc/release_notes/2.0.0.txt +0 -298
  47. data/doc/release_notes/2.1.0.txt +0 -271
  48. data/doc/release_notes/2.10.0.txt +0 -328
  49. data/doc/release_notes/2.11.0.txt +0 -215
  50. data/doc/release_notes/2.12.0.txt +0 -534
  51. data/doc/release_notes/2.2.0.txt +0 -253
  52. data/doc/release_notes/2.3.0.txt +0 -88
  53. data/doc/release_notes/2.4.0.txt +0 -106
  54. data/doc/release_notes/2.5.0.txt +0 -137
  55. data/doc/release_notes/2.6.0.txt +0 -157
  56. data/doc/release_notes/2.7.0.txt +0 -166
  57. data/doc/release_notes/2.8.0.txt +0 -171
  58. data/doc/release_notes/2.9.0.txt +0 -97
  59. data/doc/release_notes/3.0.0.txt +0 -221
  60. data/doc/release_notes/3.1.0.txt +0 -406
  61. data/doc/release_notes/3.10.0.txt +0 -286
  62. data/doc/release_notes/3.11.0.txt +0 -254
  63. data/doc/release_notes/3.12.0.txt +0 -304
  64. data/doc/release_notes/3.13.0.txt +0 -210
  65. data/doc/release_notes/3.14.0.txt +0 -118
  66. data/doc/release_notes/3.15.0.txt +0 -78
  67. data/doc/release_notes/3.16.0.txt +0 -45
  68. data/doc/release_notes/3.17.0.txt +0 -58
  69. data/doc/release_notes/3.18.0.txt +0 -120
  70. data/doc/release_notes/3.19.0.txt +0 -67
  71. data/doc/release_notes/3.2.0.txt +0 -268
  72. data/doc/release_notes/3.20.0.txt +0 -41
  73. data/doc/release_notes/3.21.0.txt +0 -87
  74. data/doc/release_notes/3.22.0.txt +0 -39
  75. data/doc/release_notes/3.23.0.txt +0 -172
  76. data/doc/release_notes/3.24.0.txt +0 -420
  77. data/doc/release_notes/3.25.0.txt +0 -88
  78. data/doc/release_notes/3.26.0.txt +0 -88
  79. data/doc/release_notes/3.27.0.txt +0 -82
  80. data/doc/release_notes/3.28.0.txt +0 -304
  81. data/doc/release_notes/3.29.0.txt +0 -459
  82. data/doc/release_notes/3.3.0.txt +0 -192
  83. data/doc/release_notes/3.30.0.txt +0 -135
  84. data/doc/release_notes/3.31.0.txt +0 -146
  85. data/doc/release_notes/3.32.0.txt +0 -202
  86. data/doc/release_notes/3.33.0.txt +0 -157
  87. data/doc/release_notes/3.34.0.txt +0 -671
  88. data/doc/release_notes/3.35.0.txt +0 -144
  89. data/doc/release_notes/3.36.0.txt +0 -245
  90. data/doc/release_notes/3.37.0.txt +0 -338
  91. data/doc/release_notes/3.38.0.txt +0 -234
  92. data/doc/release_notes/3.39.0.txt +0 -237
  93. data/doc/release_notes/3.4.0.txt +0 -325
  94. data/doc/release_notes/3.40.0.txt +0 -73
  95. data/doc/release_notes/3.41.0.txt +0 -155
  96. data/doc/release_notes/3.42.0.txt +0 -74
  97. data/doc/release_notes/3.43.0.txt +0 -105
  98. data/doc/release_notes/3.44.0.txt +0 -152
  99. data/doc/release_notes/3.45.0.txt +0 -179
  100. data/doc/release_notes/3.46.0.txt +0 -122
  101. data/doc/release_notes/3.47.0.txt +0 -270
  102. data/doc/release_notes/3.48.0.txt +0 -477
  103. data/doc/release_notes/3.5.0.txt +0 -510
  104. data/doc/release_notes/3.6.0.txt +0 -366
  105. data/doc/release_notes/3.7.0.txt +0 -179
  106. data/doc/release_notes/3.8.0.txt +0 -151
  107. data/doc/release_notes/3.9.0.txt +0 -233
@@ -1,366 +0,0 @@
1
- New Features
2
- ------------
3
-
4
- * Dataset#filter and related methods now accept a string with named
5
- placeholders, and a hash with placeholder values:
6
-
7
- ds.filter('copies_sold > :sales', :sales=>500000)
8
-
9
- Sequel's general support for this syntax is nicer:
10
-
11
- ds.filter{copies_sold > 500000}
12
-
13
- But named placeholder support can make it easier to port code
14
- from other database libraries. Also, it works much better than
15
- the ? placeholder support if you have a long SQL statement:
16
-
17
- DB['SELECT :n FROM t WHERE p > :q AND p < :r', :n=>1,:q=>2,:r=>3]
18
-
19
- Sequel doesn't subsitute values that don't appear in the hash:
20
-
21
- ds.where('price < :p AND id in :ids', :p=>100)
22
- # WHERE (price < 100 AND id in :ids)
23
-
24
- This makes it easier to spot missed placeholders, and avoids issues
25
- with PostgreSQL's :: casting syntax or : inside string literals.
26
-
27
- * The Model add_ association method now accepts a hash and creates
28
- a new associated model object associated to the receiver:
29
-
30
- Artist[:name=>'YJM'].add_album(:name=>'RF')
31
-
32
- * The Model remove_ association method now accepts a primary key
33
- and removes the associated model object from the association. For
34
- models using composite primary keys, an array of primary key values
35
- can be used. Example:
36
-
37
- Artist[:name=>'YJM'].remove_album(1) # regular pk
38
- Artist[:name=>'YJM'].remove_album([2, 3]) # composite pk
39
-
40
- * Dataset#bind was added, allowing you to bind values before calling
41
- Dataset#call. This is more consistent with Sequel's general
42
- approach where queries can be built in any order.
43
-
44
- * The native postgres adapter now has Dataset#use_cursor, which
45
- allows you to process huge datasets without keeping all records in
46
- memory. The default number of rows per cursor fetch is 1000, but
47
- that can be modified:
48
-
49
- DB[:huge_table].use_cursor.each{|r| p r}
50
- DB[:huge_table].use_cursor(:rows_per_fetch=>10000).each{|r| p r}
51
-
52
- This probably won't work with prepared statements or
53
- bound variables.
54
-
55
- * The nested_attributes plugin now adds newly created objects to the
56
- cached association array immediately, even though the changes
57
- are not persisted to the database until after the object is saved.
58
- The reasoning for this is that otherwise there is no way to access
59
- the newly created associated objects before the save, and no way
60
- to access them at all if validation fails.
61
-
62
- This makes the nested_attributes plugin much easier to use, since
63
- now you can just iterate over the cached association array when
64
- building the form. If validation fails, it will have the newly
65
- created failed objects in the array, so you can easily display the
66
- form as the user entered it for them to make changes.
67
-
68
- This change doesn't affect many_to_one associations, since those
69
- don't have a cached association array. This also does not affect
70
- updating existing records, since those are already in the cached
71
- array.
72
-
73
- * You can now easily override the default options used in the
74
- validation_helpers plugin (the recommended validation plugin).
75
- Options can be overridden at a global level:
76
-
77
- Sequel::Plugins::ValidationHelpers::DEFAULT_OPTIONS[:format].
78
- merge!(:message=>"incorrect format", :allow_missing=>true)
79
-
80
- Options can also be overridden on a per-class level:
81
-
82
- class Album < Sequel::Model
83
- plugin :validation_helpers
84
- DEFAULT_VALIDATION_OPTIONS = {
85
- :format=>{:message=>"incorrect format", :allow_missing=>true}}
86
-
87
- private
88
-
89
- def default_validation_helpers_options(type)
90
- super.merge(DEFAULT_VALIDATION_OPTIONS[type] || {})
91
- end
92
- end
93
-
94
- * You can now use a proc instead of a string for the
95
- validation_helpers :message option. This should allow much
96
- easier internationalization support. If a proc is given, Sequel
97
- calls it to get the format string to use. Whether the proc should
98
- take an argument depends on whether the associated validation
99
- method takes an argument before the array of columns to validate,
100
- and the argument provided is what is passed to the proc. The
101
- exception to this is the validates_not_string method, which doesn't
102
- take an argument, but does pass one to the proc (a symbol with the
103
- schema type of the column).
104
-
105
- Combined with the above default option support, full
106
- internationalization support for the validation_helpers plugin
107
- should be fairly easy.
108
-
109
- * The nested_attributes plugin now accepts a :fields option that
110
- specifies the fields that are allowed. If specified, the
111
- plugin will use set_only instead of set when mass assigning
112
- attributes. Without this, the only way to control which fields
113
- are allowed is to set allowed/restricted attributes at a class
114
- level in the associated class.
115
-
116
- * Associations now accept a :distinct option which uses the SQL
117
- DISTINCT clause. This can be used instead of :uniq for
118
- many_to_many and many_through_many associations to handle
119
- the uniqueness in the database instead of in ruby. It can
120
- also be useful for one_to_many associations to models that
121
- don't have primary keys.
122
-
123
- * The caching plugin now accepts an :ignore_exceptions option that
124
- allows it to work with memcached (which raises exceptions instead
125
- of returning nil for missing records).
126
-
127
- * Sequel now emulates JOIN USING poorly using JOIN ON for databases
128
- that don't support JOIN USING (MSSQL and H2). This isn't
129
- guaranteed to work for all queries, since USING and ON have
130
- different semantics, but should work in most cases.
131
-
132
- * The MSSQL shared adapter now supports insert_select, for faster
133
- model object creation. If for some reason you need to disable it,
134
- you can use disable_insert_output.
135
-
136
- * Model#modified! has been added which explicitly marks the object
137
- as modified. So even if no column values have been modified,
138
- calling save_changes/update will still run through the regular
139
- save process and call all before and after save/update hooks.
140
-
141
- * Model#marshallable! has been added which removes unmarshallable
142
- attributes from the object. Previously, you couldn't marshal
143
- a saved model object because it contained a dataset with a
144
- singleton class. Custom _dump and _load methods could be used
145
- instead, but this approach is easier to implement.
146
-
147
- * Dataset#literal_other now calls sql_literal on the object with
148
- the current dataset instance, if the object responds to it.
149
- This makes it easier to support the literalization of arbitrary
150
- objects.
151
-
152
- Note that if the object is a subclass of a class handled by
153
- an existing dataset literalization method, you cannot use this
154
- method. You have to override the specific Dataset#literal_* method
155
- in that case.
156
-
157
- * Model#save_changes now accepts an option hash that is passed to
158
- save:
159
-
160
- album.save_changes(:validate=>false)
161
-
162
- * A bunch of Dataset#*_join methods have been added, for specific
163
- join types:
164
-
165
- * cross_join
166
- * natural_join
167
- * full_join
168
- * left_join
169
- * right_join
170
- * natural_full_join
171
- * natural_left_join
172
- * natural_right_join
173
-
174
- Previously, you had to use join_table(:cross, ...) to use a CROSS
175
- JOIN.
176
-
177
- * You can now create clustered indexes on Microsoft SQL Server using
178
- the :clustered option.
179
-
180
- * AssociationReflection#associated_object_keys has been added,
181
- specifying the keys in the associated model object that are related
182
- to this association.
183
-
184
- * Sequel::SQL::SQLArray#to_a was added.
185
-
186
- Other Improvements
187
- ------------------
188
-
189
- * Constant lookup in virtual row blocks now works correctly in ruby
190
- 1.9. Virtual row blocks are based on BasicObject on ruby 1.9,
191
- which doesn't allow referencing objects in the top level scope. So
192
- the following code would cause an error on 1.9:
193
-
194
- DB[:bonds].filter{maturity_date > Time.now}
195
-
196
- Sequel now uses a Sequel::BasicObject class on 1.9 with a
197
- const_missing that looks up constants in Object, which allows the
198
- above code to work.
199
-
200
- * Sequel no longer attempts to load associated objects when
201
- one of the key fields in the current table is NULL. This fixes
202
- the behavior when the :primary_key option for the association
203
- is used to point to a non-primary key.
204
-
205
- A consequence of this change is that attempting to load a
206
- *_to_many association for a new model object now returns
207
- an empty array instead of raising an exception. This has its
208
- own advantage of allowing the same association viewing code
209
- to work on both new and existing objects. Previously, you had
210
- to actively avoid calling the association method on new objects,
211
- or Sequel would raise an exception.
212
-
213
- * Dataset aggreate methods (sum/avg/min/max/range/interval) now
214
- work correctly with limited, grouped, or compound datasets.
215
- Previously, count worked with them, but other aggregate methods
216
- did not. These methods now use a subquery if called on a
217
- limited, grouped or compound dataset.
218
-
219
- * It is no longer required to have an existing GROUP BY clause
220
- to use a HAVING clause (except on SQLite, which doesn't permit
221
- it). Sequel has always had this limitation, but it's not required
222
- by the SQL standard, and there are valid reasons to use HAVING
223
- without GROUP BY.
224
-
225
- * Sequel will now emulate support for databases that don't support
226
- multiple column IN/NOT IN syntax, such as MSSQL and SQLite:
227
-
228
- ds.filter([:col1, :col2]=>[[1, 2], [3, 4]].sql_array)
229
- # default: WHERE (col1, col2) IN ((1, 2), (3, 4))
230
- # emulated: WHERE (((col1 = 1) AND (col2 = 2)) OR
231
- # ((col1 = 3) AND (col2 = 4)))
232
-
233
- This is necessary for eager loading associated objects for models
234
- with composite primary keys.
235
-
236
- * Sequel now emulates :column.ilike('blah%') for case insensitive
237
- searches on MSSQL and H2. MSSQL is case insensitive by default,
238
- so it is the same as like. H2 is case sensitive, so Sequel
239
- uses a case insensitive cast there.
240
-
241
- * The nested_attributes plugin no longer allows modification of
242
- keys related to the association. This fixes a possible security
243
- issue with the plugin, where a user could associate the nested
244
- record to a different record. For example:
245
-
246
- Artist.one_to_many :albums
247
- Artist.plugin :nested_attributes
248
- Artist.nested_attributes :albums
249
- artist = Artist.create
250
- artist2 = Artist.create
251
- album = Album.create
252
- artist.add_album(album)
253
- artist.albums_attributes = [{:id=>album.id,
254
- :artist_id=>artist2.id}]
255
- artist.save
256
-
257
- * The one_to_many remove_* association method now makes sure that the
258
- object to be removed is currently associated to this object.
259
- Before, the method could be abused to disassociate the object from
260
- whatever object it was associated to.
261
-
262
- * Model add_ and remove_ association methods now check that the passed
263
- object is of the correct class.
264
-
265
- * Calling the add_* association method no longer adds the record
266
- to the cached association array if the object is already in the
267
- array. Previously, Sequel did this for reciprocal associations,
268
- but not for regular associations.
269
-
270
- This makes the most sense for one_to_many associations, since
271
- those can only be associated to the object once. For many_to_many
272
- associations, if you want an option to disable the behavior, please
273
- bring it up on the Sequel mailing list.
274
-
275
- * An array with a string and placeholders that is passed to
276
- Dataset#filter is no longer modified. Previously:
277
-
278
- options = ["name like ?", "%dog%"]
279
- DB[:players].where(options)
280
- options # => ["%dog%"]
281
-
282
- * Getting the most recently inserted autoincremented primary key
283
- is now optimized when connecting to MySQL via JDBC.
284
-
285
- * Model.inherited now calls Class.inherited.
286
-
287
- * The MSSQL shared adapter once again works on ruby 1.9. It was
288
- broken in 3.5.0 due to minor syntax issues.
289
-
290
- * The force_encoding plugin now handles refreshing an existing
291
- object, either explicitly or implicitly when new objects are
292
- created.
293
-
294
- To use the force_encoding plugin with the identity_map plugin, the
295
- identity_map plugin should be loaded first.
296
-
297
- * Using nil as a bound variable now works on PostgreSQL. Before,
298
- Sequel would incorrectly use "" instead of NULL, since it
299
- transformed all objects to strings before binding them. Sequel
300
- now binds the objects directly.
301
-
302
- * The Amalgalite adapter is now significantly faster, especially for
303
- code that modifies the schema or submits arbitrary SQL statements
304
- using Database <<, run, or execute_ddl.
305
-
306
- * Model#save_changes is now used when updating existing associated
307
- objects in the nested_attributes plugin. This should be
308
- significantly faster for the common case of submitting a complex
309
- form with nested objects without making modifications.
310
-
311
- * You can now prepare insert statements that take multiple arguments,
312
- such as insert(1, 2, 3) and insert(columns, values).
313
-
314
- * Dataset#group_and_count now supports aliased columns.
315
-
316
- * Adding indexes to tables outside the default schema now works.
317
-
318
- * Eager graphing now works better with models that use aliased tables.
319
-
320
- * Sequel now correctly parses the column schema information for tables
321
- in a non-default schema on Microsoft SQL Server.
322
-
323
- * changed_columns is now cleared for when saving new model objects
324
- for adapters that support insert_select, such as PostgreSQL.
325
-
326
- * Dataset#replace on MySQL now works correctly when default values
327
- are used.
328
-
329
- * Dataset#lock on PostgreSQL now works correctly.
330
-
331
- * Dataset#explain now works correctly on SQLite, and works using
332
- any adapter. It also works correctly on Amalgalite.
333
-
334
- * The JDBC adapter now handles binding Time arguments correctly when
335
- using prepared statements.
336
-
337
- * Model add_ and remove_ association methods now have more
338
- descriptive exception messages.
339
-
340
- * Dataset#simple_select_all? now ignores options that don't affect
341
- the SQL, such as :server.
342
-
343
- * Dataset#window in the PostgreSQL adapter now respects existing
344
- named windows.
345
-
346
- * Sequel now better handles a failure to begin a new transaction.
347
-
348
- * The dataset code was split into some additional files for improved
349
- readability.
350
-
351
- * Many documentation improvements were made.
352
-
353
- Backwards Compatibility
354
- -----------------------
355
-
356
- * Model::Errors no longer uses a default proc, but emulates one in the
357
- [] method. This is unlikely to have a negative affect unless you
358
- are calling a method on it that doesn't call [] (maybe using it in
359
- a C extension?).
360
-
361
- * Model#table_name now only provides the alias if an aliased table is
362
- used.
363
-
364
- * The Sequel::Dataset::STOCK_COUNT_OPTS constant has been removed.
365
-
366
- * Dataset#lock on PostgreSQL now returns nil instead of a dataset.
@@ -1,179 +0,0 @@
1
- New Features
2
- ------------
3
-
4
- * Sequel now has support for deleting and updating joined datasets
5
- on MySQL and PostgreSQL. Previously, Sequel only supported this to
6
- a limited extent on Microsoft SQL Server, and support there has been
7
- improved as well.
8
-
9
- This allows you to do:
10
-
11
- DB.create_table!(:a){Integer :a; Integer :d}
12
- DB.create_table!(:b){Integer :b; Integer :e}
13
- DB.create_table!(:c){Integer :c; Integer :f}
14
-
15
- # Insert some rows
16
-
17
- ds = DB.from(:a, :b).
18
- join(:c, :c=>:e.identifier).
19
- where(:d=>:b)
20
- ds.where(:f=>6).update(:a => 10)
21
- ds.where(:f=>5).delete
22
-
23
- Which will set the a column to 10 for all rows in table a, where
24
- an associated row in table c (through table b) has a value of 6 for
25
- column f. It will delete rows from table a where an associated row
26
- in table c (through table b) has a value of 5 for column f.
27
-
28
- Sequel assumes the that first FROM table is the table being
29
- updated/deleted. MySQL and Microsoft SQL Server do not require
30
- multiple FROM tables, but PostgreSQL does.
31
-
32
- * Dataset #select_map, #select_order_map, and #select_hash
33
- convenience methods were added for quickly creating arrays and
34
- hashes from a dataset.
35
-
36
- select_map and select_order_map both return arrays of values for the
37
- column specified. The column can be specified either via an argument
38
- or a block, similar to Dataset#get. Both accept any valid objects as
39
- arguments.
40
-
41
- select_hash returns a hash. It requires two symbol arguments, but
42
- can handle implicit qualifiers or aliases in the symbols.
43
-
44
- Neither of these methods offer any new functionality, they just cut
45
- down on the number of required key strokes:
46
-
47
- select_map(:column) # select(:column).map(:column)
48
- select_order_map(:column) # select(:column).order(:column).
49
- # map(:column)
50
- select_hash(:key_column, :value_column)
51
- # select(:key_column, :value_column).
52
- # to_hash(:key_column, :value_column)
53
-
54
- * The NULL, NOTNULL, TRUE, SQLTRUE, FALSE, and SQLFALSE constants
55
- were added to Sequel::SQL::Constants. This allows you to do:
56
-
57
- include Sequel::SQL::Constants
58
- DB[:table].where(:a=>'1', :b=>NOTNULL)
59
-
60
- Previously, the shortest way to do this was:
61
-
62
- DB[:table].where(:a=>'1').exclude(:b=>nil)
63
-
64
- It may make the code more descriptive:
65
-
66
- DB[:table].where(:b=>NULL)
67
- # compared to
68
- DB[:table].where(:b=>nil)
69
-
70
- This gives the option to use SQL terminology instead of ruby
71
- terminology.
72
-
73
- The other advantage of using the constants it that they handle
74
- operators and methods like other Sequel::SQL objects:
75
-
76
- NULL & SQLFALSE # BooleanExpression => "(NULL AND FALSE)"
77
- nil & false # false
78
-
79
- NULL + :a # NumericExpression => "(NULL + a)"
80
- nil + :a # raises NoMethodError
81
- NULL.sql_string + :a # StringExpression => "(NULL || a)"
82
- NULL.as(:b) # AliasedExpression => "NULL AS b"
83
-
84
- For complex systems that want to represent SQL boolean objects
85
- in ruby (where you don't know exactly how they'll be used), using
86
- the constants is recommended.
87
-
88
- In order not to be too verbose, including Sequel::SQL::Constants
89
- is recommended. It's not done by default, but you can still
90
- reference the constants under the main Sequel module by default
91
- (e.g. Sequel::NULL).
92
-
93
- * The validates_unique method in the validation_helpers plugin now
94
- supports an :only_if_modified option, which should speed up the
95
- common case where the unique attribute is not modified for an
96
- existing record. It's not on by default, since it's possible the
97
- database could be changed between retrieving the model object and
98
- updating it.
99
-
100
- * The Dataset #union, #intersect, and #except methods now accept an
101
- :alias option which is used as the alias for the returned dataset.
102
-
103
- DB[:table].union(DB[:old_table], :alias=>:table)
104
-
105
- * Model#destroy now supports a :transaction option, similar to
106
- Model#save.
107
-
108
- * The shared Oracle adapter now supports Dataset#sequence for
109
- returning autogenerated primary key values on insert from a
110
- related sequence.
111
-
112
- This makes Oracle work correctly when using models, with
113
- something like the following:
114
-
115
- class Album < Sequel::Model
116
- set_dataset dataset.sequence(:seq_albums_id)
117
- end
118
-
119
- You currently need to call Dataset#sequence in every model
120
- class where the underlying table uses a sequence to generate
121
- primary key values.
122
-
123
- Other Improvements
124
- ------------------
125
-
126
- * In Model #save and #destroy when using transactions and when
127
- raise_on_save_failure is false, ensure that transactions are rolled
128
- back if a before hook returns false.
129
-
130
- * Dataset#group_and_count now handles arguments other than Symbols.
131
- A previous change to the method raised an exception if a Symbol was
132
- not provided. It also handles AliasedExpressions natively, so the
133
- following works correctly:
134
-
135
- DB[:table].group_and_count(:column.as(:alias))
136
-
137
- * Sequel no longer uses native autoreconnection in the mysql adapter.
138
- Native autoreconnection has problems with prepared statements,
139
- where a new native connection is used behind Sequel's back, so
140
- Sequel thinks the prepared statement has already been defined on
141
- the connection, when it fact it hasn't. Any other changes that
142
- affect the state of the connection will be lost when native
143
- autoreconnection is used as well.
144
-
145
- Sequel's connection pool already handles reconnection if it detects
146
- a disconnection. This commit also adds an additional exception
147
- message to recognize as a disconnect. If there other exception
148
- messages related to disconnects, please post them on the Sequel
149
- mailing list.
150
-
151
- * The schema_dumper plugin now specifies the :type option for primary
152
- key if it isn't Integer.
153
-
154
- * On PostgreSQL, the bigserial type is used if :type=>Bignum is
155
- given as an option to primary key. This makes it operate more
156
- similarly to other adapters that support autoincrementing 64-bit
157
- integer primary keys.
158
-
159
- * The native mysql adapter will now attempt to load options in the
160
- [client] section of the my.cnf file.
161
-
162
- * The rake spec tasks for the project now work correctly with RSpec
163
- 1.2.9.
164
-
165
- Backwards Compatibility
166
- -----------------------
167
-
168
- * Dataset::GET_ERROR_MSG and Dataset::MAP_ERROR_MSG constants were
169
- removed. Both were replaced with Dataset::ARG_BLOCK_ERROR_MSG.
170
-
171
- * The behavior of the Model#save_failure private instance method was
172
- modified. It now always raises an exception, and validation
173
- failures no longer call it.
174
-
175
- * The internals of how autogenerated primary key metadata is stored
176
- when creating tables on PostgreSQL has been modified.
177
-
178
- * The native MySQL adapter no longer sets the OPT_LOCAL_INFILE option
179
- to "client" on the native connection.