sequel 5.6.0 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +30 -5099
- data/Rakefile +1 -1
- data/doc/opening_databases.rdoc +0 -2
- data/doc/postgresql.rdoc +31 -0
- data/doc/querying.rdoc +2 -2
- data/doc/release_notes/5.7.0.txt +108 -0
- data/doc/testing.rdoc +1 -0
- data/lib/sequel/adapters/jdbc/derby.rb +1 -1
- data/lib/sequel/adapters/jdbc/oracle.rb +11 -0
- data/lib/sequel/adapters/postgres.rb +1 -0
- data/lib/sequel/adapters/shared/postgres.rb +117 -13
- data/lib/sequel/connection_pool/sharded_threaded.rb +7 -6
- data/lib/sequel/connection_pool/threaded.rb +6 -6
- data/lib/sequel/core.rb +20 -0
- data/lib/sequel/database/logging.rb +3 -2
- data/lib/sequel/database/schema_generator.rb +1 -2
- data/lib/sequel/dataset/actions.rb +15 -5
- data/lib/sequel/extensions/connection_expiration.rb +3 -3
- data/lib/sequel/extensions/connection_validator.rb +3 -3
- data/lib/sequel/extensions/integer64.rb +30 -0
- data/lib/sequel/extensions/migration.rb +2 -3
- data/lib/sequel/plugins/pg_array_associations.rb +5 -3
- data/lib/sequel/plugins/validate_associated.rb +18 -0
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mssql_spec.rb +6 -6
- data/spec/adapters/mysql_spec.rb +1 -1
- data/spec/adapters/oracle_spec.rb +15 -1
- data/spec/adapters/postgres_spec.rb +78 -1
- data/spec/adapters/spec_helper.rb +3 -1
- data/spec/bin_spec.rb +1 -0
- data/spec/core/dataset_spec.rb +10 -0
- data/spec/extensions/integer64_spec.rb +22 -0
- data/spec/extensions/pg_array_associations_spec.rb +14 -2
- data/spec/extensions/spec_helper.rb +1 -0
- data/spec/integration/associations_test.rb +4 -4
- data/spec/integration/dataset_test.rb +2 -0
- data/spec/integration/spec_helper.rb +5 -11
- data/spec/model/spec_helper.rb +1 -0
- metadata +35 -165
- data/doc/release_notes/1.0.txt +0 -38
- data/doc/release_notes/1.1.txt +0 -143
- data/doc/release_notes/1.3.txt +0 -101
- data/doc/release_notes/1.4.0.txt +0 -53
- data/doc/release_notes/1.5.0.txt +0 -155
- data/doc/release_notes/2.0.0.txt +0 -298
- data/doc/release_notes/2.1.0.txt +0 -271
- data/doc/release_notes/2.10.0.txt +0 -328
- data/doc/release_notes/2.11.0.txt +0 -215
- data/doc/release_notes/2.12.0.txt +0 -534
- data/doc/release_notes/2.2.0.txt +0 -253
- data/doc/release_notes/2.3.0.txt +0 -88
- data/doc/release_notes/2.4.0.txt +0 -106
- data/doc/release_notes/2.5.0.txt +0 -137
- data/doc/release_notes/2.6.0.txt +0 -157
- data/doc/release_notes/2.7.0.txt +0 -166
- data/doc/release_notes/2.8.0.txt +0 -171
- data/doc/release_notes/2.9.0.txt +0 -97
- data/doc/release_notes/3.0.0.txt +0 -221
- data/doc/release_notes/3.1.0.txt +0 -406
- data/doc/release_notes/3.10.0.txt +0 -286
- data/doc/release_notes/3.11.0.txt +0 -254
- data/doc/release_notes/3.12.0.txt +0 -304
- data/doc/release_notes/3.13.0.txt +0 -210
- data/doc/release_notes/3.14.0.txt +0 -118
- data/doc/release_notes/3.15.0.txt +0 -78
- data/doc/release_notes/3.16.0.txt +0 -45
- data/doc/release_notes/3.17.0.txt +0 -58
- data/doc/release_notes/3.18.0.txt +0 -120
- data/doc/release_notes/3.19.0.txt +0 -67
- data/doc/release_notes/3.2.0.txt +0 -268
- data/doc/release_notes/3.20.0.txt +0 -41
- data/doc/release_notes/3.21.0.txt +0 -87
- data/doc/release_notes/3.22.0.txt +0 -39
- data/doc/release_notes/3.23.0.txt +0 -172
- data/doc/release_notes/3.24.0.txt +0 -420
- data/doc/release_notes/3.25.0.txt +0 -88
- data/doc/release_notes/3.26.0.txt +0 -88
- data/doc/release_notes/3.27.0.txt +0 -82
- data/doc/release_notes/3.28.0.txt +0 -304
- data/doc/release_notes/3.29.0.txt +0 -459
- data/doc/release_notes/3.3.0.txt +0 -192
- data/doc/release_notes/3.30.0.txt +0 -135
- data/doc/release_notes/3.31.0.txt +0 -146
- data/doc/release_notes/3.32.0.txt +0 -202
- data/doc/release_notes/3.33.0.txt +0 -157
- data/doc/release_notes/3.34.0.txt +0 -671
- data/doc/release_notes/3.35.0.txt +0 -144
- data/doc/release_notes/3.36.0.txt +0 -245
- data/doc/release_notes/3.37.0.txt +0 -338
- data/doc/release_notes/3.38.0.txt +0 -234
- data/doc/release_notes/3.39.0.txt +0 -237
- data/doc/release_notes/3.4.0.txt +0 -325
- data/doc/release_notes/3.40.0.txt +0 -73
- data/doc/release_notes/3.41.0.txt +0 -155
- data/doc/release_notes/3.42.0.txt +0 -74
- data/doc/release_notes/3.43.0.txt +0 -105
- data/doc/release_notes/3.44.0.txt +0 -152
- data/doc/release_notes/3.45.0.txt +0 -179
- data/doc/release_notes/3.46.0.txt +0 -122
- data/doc/release_notes/3.47.0.txt +0 -270
- data/doc/release_notes/3.48.0.txt +0 -477
- data/doc/release_notes/3.5.0.txt +0 -510
- data/doc/release_notes/3.6.0.txt +0 -366
- data/doc/release_notes/3.7.0.txt +0 -179
- data/doc/release_notes/3.8.0.txt +0 -151
- data/doc/release_notes/3.9.0.txt +0 -233
data/doc/release_notes/3.5.0.txt
DELETED
@@ -1,510 +0,0 @@
|
|
1
|
-
New Plugins
|
2
|
-
-----------
|
3
|
-
|
4
|
-
* A class_table_inheritance plugin has been added, supporting model
|
5
|
-
inheritance in the database using a table-per-model-class approach.
|
6
|
-
Each table stores only attributes unique to that model or subclass
|
7
|
-
hierarchy.
|
8
|
-
|
9
|
-
For example, with this hierarchy:
|
10
|
-
|
11
|
-
Employee
|
12
|
-
/ \
|
13
|
-
Staff Manager
|
14
|
-
|
|
15
|
-
Executive
|
16
|
-
|
17
|
-
the following database schema may be used (table - columns):
|
18
|
-
|
19
|
-
* employees - id, name, kind
|
20
|
-
* staff - id, manager_id
|
21
|
-
* managers - id, num_staff
|
22
|
-
* executives - id, num_managers
|
23
|
-
|
24
|
-
The class_table_inheritance plugin assumes that the main table
|
25
|
-
(e.g. employees) has a primary key field (usually
|
26
|
-
autoincrementing), and all other tables have a foreign key of the
|
27
|
-
same name that points to the same key in their superclass's table.
|
28
|
-
For example:
|
29
|
-
|
30
|
-
* employees.id - primary key, autoincrementing
|
31
|
-
* staff.id - foreign key referencing employees(id)
|
32
|
-
* managers.id - foreign key referencing employees(id)
|
33
|
-
* executives.id - foreign key referencing managers(id)
|
34
|
-
|
35
|
-
When using the class_table_inheritance plugin, subclasses use joined
|
36
|
-
datasets:
|
37
|
-
|
38
|
-
Employee.dataset.sql # SELECT * FROM employees
|
39
|
-
Manager.dataset.sql # SELECT * FROM employees
|
40
|
-
# INNER JOIN managers USING (id)
|
41
|
-
Executive.dataset.sql # SELECT * FROM employees
|
42
|
-
# INNER JOIN managers USING (id)
|
43
|
-
# INNER JOIN executives USING (id)
|
44
|
-
|
45
|
-
This allows Executive.all to return instances with all attributes
|
46
|
-
loaded. The plugin overrides deleting, inserting, and updating
|
47
|
-
in the model to work with multiple tables, by handling each table
|
48
|
-
individually.
|
49
|
-
|
50
|
-
This plugin allows and encourages the use of a :key option to mark
|
51
|
-
a column holding the class name. This allows methods on the
|
52
|
-
superclass to return instances of specific subclasses.
|
53
|
-
|
54
|
-
a = Employee.all # [<#Staff>, <#Manager>, <#Executive>]
|
55
|
-
|
56
|
-
This plugin requires the lazy_attributes plugin and uses it to
|
57
|
-
handle subclass specific attributes that would not be loaded
|
58
|
-
when calling superclass methods (since those wouldn't join
|
59
|
-
to the subclass tables). For example:
|
60
|
-
|
61
|
-
a.first.values # {:id=>1, name=>'S', :kind=>'Staff'}
|
62
|
-
a.first.manager_id # Loads the manager_id attribute from the
|
63
|
-
# database
|
64
|
-
|
65
|
-
The class_table_inheritance plugin requires JOIN USING and
|
66
|
-
therefore is not supported on H2 or Microsoft SQL Server, which do
|
67
|
-
not support that SQL-92 feature.
|
68
|
-
|
69
|
-
* An associations_dependencies plugin was added for deleting,
|
70
|
-
destroying, or nullifying associated objects when destroying a
|
71
|
-
model object. This just gives an easy way to add the necessary
|
72
|
-
before and after destroy hooks. The following association types
|
73
|
-
support the following dependency actions:
|
74
|
-
|
75
|
-
* :many_to_many - :nullify (removes all related entries in join
|
76
|
-
table)
|
77
|
-
* :many_to_one - :delete, :destroy
|
78
|
-
* :one_to_many - :delete, :destroy, :nullify (sets foreign key to
|
79
|
-
NULL for all associated objects)
|
80
|
-
|
81
|
-
This plugin works directly with the association datasets and does
|
82
|
-
not use any cached association values. The :delete action will
|
83
|
-
delete all associated objects from the database in a single SQL
|
84
|
-
call. The :destroy action will load each associated object from the
|
85
|
-
database and call the destroy method on it.
|
86
|
-
|
87
|
-
The plugin call takes a hash of association symbol keys and
|
88
|
-
dependency action symbol values. Alternatively, you can specify
|
89
|
-
additional dependencies later using add_association_dependencies:
|
90
|
-
|
91
|
-
Business.plugin :association_dependencies, :address=>:delete
|
92
|
-
# or:
|
93
|
-
Artist.plugin :association_dependencies
|
94
|
-
Artist.add_association_dependencies :albums=>:destroy,
|
95
|
-
:reviews=>:delete, :tags=>:nullify
|
96
|
-
|
97
|
-
* A force_encoding plugin was added that forces the encoding of
|
98
|
-
strings used in model instances. When model instances are loaded
|
99
|
-
from the database, all values in the hash that are strings are
|
100
|
-
forced to the given encoding. Whenever you update a model column
|
101
|
-
attribute, the resulting value is forced to a given encoding if the
|
102
|
-
value is a string. There are two ways to specify the encoding.
|
103
|
-
You can either do so in the plugin call itself, or via the
|
104
|
-
forced_encoding class accessor:
|
105
|
-
|
106
|
-
class Album < Sequel::Model
|
107
|
-
plugin :force_encoding, 'UTF-8'
|
108
|
-
# or
|
109
|
-
plugin :force_encoding
|
110
|
-
self.forced_encoding = 'UTF-8'
|
111
|
-
end
|
112
|
-
|
113
|
-
This plugin only works on ruby 1.9, since strings don't have
|
114
|
-
encodings in 1.8.
|
115
|
-
|
116
|
-
* A typecast_on_load plugin was added, for fixing bad database
|
117
|
-
typecasting when loading model objects. Most of Sequel's database
|
118
|
-
adapters don't have complete control over typecasting, and may
|
119
|
-
return columns that aren't typecast correctly (with correct being
|
120
|
-
defined as how the model object would typecast the same column
|
121
|
-
values).
|
122
|
-
|
123
|
-
This plugin modifies Model.load to call the setter methods (which
|
124
|
-
typecast by default) for all columns given. You can either specify
|
125
|
-
the columns to typecast on load in the plugin call itself, or
|
126
|
-
afterwards using add_typecast_on_load_columns:
|
127
|
-
|
128
|
-
Album.plugin :typecast_on_load, :release_date, :record_date
|
129
|
-
# or:
|
130
|
-
Album.plugin :typecast_on_load
|
131
|
-
Album.add_typecast_on_load_columns :release_date, :record_date
|
132
|
-
|
133
|
-
If the database returns release_date and record_date columns as
|
134
|
-
strings instead of dates, this will ensure that if you access those
|
135
|
-
columns through the model object, you'll get Date objects instead of
|
136
|
-
strings.
|
137
|
-
|
138
|
-
* A touch plugin was added, which adds Model#touch for updating an
|
139
|
-
instance's timestamp, as well as touching associations when an
|
140
|
-
instance is updated or destroyed.
|
141
|
-
|
142
|
-
The Model#touch instance method saves the object with a modified
|
143
|
-
timestamp. By default, it uses the :updated_at column, but you can
|
144
|
-
set which column to use. It also supports touching of associations,
|
145
|
-
so that when the current model object is updated or destroyed, the
|
146
|
-
associated rows in the database can have their modified timestamp
|
147
|
-
updated to the current timestamp. Example:
|
148
|
-
|
149
|
-
class Album < Sequel::Model
|
150
|
-
plugin :touch, :column=>:modified_on, :associations=>:artist
|
151
|
-
end
|
152
|
-
|
153
|
-
* A subclasses plugin was added, for recording all of a models
|
154
|
-
subclasses and descendent classes. Direct subclasses are available
|
155
|
-
via the subclasses method, and all descendent classes are available
|
156
|
-
via the descendents method:
|
157
|
-
|
158
|
-
c = Class.new(Sequel::Model)
|
159
|
-
c.plugin :subclasses
|
160
|
-
sc1 = Class.new(c)
|
161
|
-
sc2 = Class.new(c)
|
162
|
-
ssc1 = Class.new(sc1)
|
163
|
-
c.subclasses # [sc1, sc2]
|
164
|
-
sc1.subclasses # [ssc1]
|
165
|
-
sc2.subclasses # []
|
166
|
-
ssc1.subclasses # []
|
167
|
-
c.descendents # [sc1, ssc1, sc2]
|
168
|
-
|
169
|
-
The main use case for this is if you want to modify all models
|
170
|
-
after the model subclasses have been created. Since mutable
|
171
|
-
options are copied when subclassing, modifying parent classes
|
172
|
-
does not affect current subclasses, only future ones. The
|
173
|
-
subclasses plugin allows you get all subclasses so that you can
|
174
|
-
easily modify them. The plugin only records subclasses
|
175
|
-
created after the plugin call, though.
|
176
|
-
|
177
|
-
* An active_model plugin was added, giving Sequel::Model an
|
178
|
-
ActiveModel complaint API, in so much as it passes the
|
179
|
-
ActiveModel::Lint tests.
|
180
|
-
|
181
|
-
New Extensions
|
182
|
-
--------------
|
183
|
-
|
184
|
-
* A named_timezones extension was added, allowing you to use named
|
185
|
-
timezones such as "America/Los_Angeles" (the default Sequel
|
186
|
-
timezone support only supports UTC or local time). This extension
|
187
|
-
requires TZInfo. It also sets the Sequel.datetime_class to
|
188
|
-
DateTime, so database timestamps will be returned as DateTime
|
189
|
-
instances instead of Time instances. This is because ruby's
|
190
|
-
Time class doesn't support timezones other than UTC and local time.
|
191
|
-
|
192
|
-
This plugin allows you to pass either strings or TZInfo::Timezone
|
193
|
-
instance to Sequel.database_timezone=, application_timezone=, and
|
194
|
-
typecast_timezone=. If a string is passed, it is converted to a
|
195
|
-
TZInfo::Timezone using TZInfo::Timezone.get.
|
196
|
-
|
197
|
-
Let's say you have the database server in New York and the
|
198
|
-
application server in Los Angeles. For historical reasons, data
|
199
|
-
is stored in local New York time, but the application server only
|
200
|
-
services clients in Los Angeles, so you want to use New York
|
201
|
-
time in the database and Los Angeles time in the application. This
|
202
|
-
is easily done via:
|
203
|
-
|
204
|
-
Sequel.database_timezone = 'America/New_York'
|
205
|
-
Sequel.application_timezone = 'America/Los_Angeles'
|
206
|
-
|
207
|
-
Then, before timestamps are stored in the database, they are
|
208
|
-
converted to New York time. When timestamps are retrieved from the
|
209
|
-
database, they are converted to Los Angeles time.
|
210
|
-
|
211
|
-
* A thread_local_timezones extension was added. This allows you to
|
212
|
-
set a per-thread timezone that will override the default global
|
213
|
-
timezone while the thread is executing. The main use case is for
|
214
|
-
web applications that execute each request in its own thread, and
|
215
|
-
want to set the timezones based on the request. The most common
|
216
|
-
example is having the database always store time in UTC, but have
|
217
|
-
the application deal with the timezone of the current user. That
|
218
|
-
can be done with:
|
219
|
-
|
220
|
-
Sequel.database_timezone = :utc
|
221
|
-
# In each thread:
|
222
|
-
Sequel.thread_application_timezone = current_user.timezone
|
223
|
-
|
224
|
-
This extension is designed to work with the named_timezones
|
225
|
-
extension.
|
226
|
-
|
227
|
-
* An sql_expr extension was added that adds .sql_expr methods to
|
228
|
-
all objects, giving them easy access to Sequel's DSL:
|
229
|
-
|
230
|
-
1.sql_expr < :a # 1 < a
|
231
|
-
false.sql_expr & :a # FALSE AND a
|
232
|
-
true.sql_expr | :a # TRUE OR a
|
233
|
-
~nil.sql_expr # NOT NULL
|
234
|
-
"a".sql_expr + "b" # 'a' || 'b'
|
235
|
-
|
236
|
-
Proc#sql_expr uses a virtual row:
|
237
|
-
|
238
|
-
proc{[[a, b], [a, c]]}.sql_expr | :x
|
239
|
-
# (((a = b) AND (a = c)) OR x)
|
240
|
-
|
241
|
-
* A looser_typecasting extension was added, for using to_f and to_i
|
242
|
-
instead of the more strict Kernel.Float and Kernel.Integer when
|
243
|
-
typecasting floats and integers. To use it, you should extend the
|
244
|
-
database with the Sequel::LooserTypecasting module after loading
|
245
|
-
the extension:
|
246
|
-
|
247
|
-
Sequel.extension :looser_typecasting
|
248
|
-
DB.extend(Sequel::LooserTypecasting)
|
249
|
-
|
250
|
-
This makes the behavior more like ActiveRecord:
|
251
|
-
|
252
|
-
a = Artist.new(:num_albums=>'a')
|
253
|
-
a.num_albums # => 0
|
254
|
-
|
255
|
-
Other New Features
|
256
|
-
------------------
|
257
|
-
|
258
|
-
* Associations now support composite keys. All of the :*key options
|
259
|
-
options now accept arrays of symbols instead of plain symbols.
|
260
|
-
Example:
|
261
|
-
|
262
|
-
Artist.primary_key # [:name, :city]
|
263
|
-
Album.many_to_one :artist, :key=>[:artist_name, :artist_city]
|
264
|
-
Artist.one_to_many :albums, :key=>[:artist_name, :artist_city]
|
265
|
-
|
266
|
-
All association types are supported, including the built-in
|
267
|
-
many_to_many association and the many_through_many plugin. Both
|
268
|
-
methods of eager loading work with composite keys for all
|
269
|
-
association types. Setter and add/remove/remove_all methods
|
270
|
-
also now work with composite keys.
|
271
|
-
|
272
|
-
* Associations now respect a :validate option, which can be set to
|
273
|
-
false to not validate when implicitly saving associated objects.
|
274
|
-
|
275
|
-
There isn't a lot of implicit saving in Sequel's association
|
276
|
-
methods, but this gives the user the control over validation when
|
277
|
-
the association methods implicitly save an object.
|
278
|
-
|
279
|
-
* In addition to the regular association methods, the
|
280
|
-
nested_attributes plugin was also updated to respect the
|
281
|
-
:validate_association option. It was also modified to not validate
|
282
|
-
associated objects twice, once when the parent object was validated
|
283
|
-
and again when the associated object was saved. Additionally, if
|
284
|
-
you pass :validate=>false to the save method when saving the parent
|
285
|
-
object, it will not longer attempt to validate associated objects
|
286
|
-
when saving them.
|
287
|
-
|
288
|
-
* Dataset#insert and #insert_sql were refactored and now support the
|
289
|
-
following API:
|
290
|
-
|
291
|
-
* No arguments - Treat as a single empty hash argument
|
292
|
-
* Single argument:
|
293
|
-
* Hash - Use keys as columns and values as values
|
294
|
-
* Array - Use as values, without specifying columns
|
295
|
-
* Dataset - Use a subselect, without specifying columns
|
296
|
-
* LiteralString - Use as the values
|
297
|
-
* 2 arguments:
|
298
|
-
* Array, Array - Use first array as keys, second as values
|
299
|
-
* Array, Dataset - Use a subselect, with the array as columns
|
300
|
-
* Array, LiteralString - Use LiteralString as the values, with
|
301
|
-
the array as the columns
|
302
|
-
* Anything else: Treat all given values an an array of values
|
303
|
-
|
304
|
-
* Graphing now works with previously joined datasets. The main use
|
305
|
-
case of this is when eagerly loading (via eager_graph) model
|
306
|
-
associations for models backed by joined datasets, such as those
|
307
|
-
created by the class_table_inheritance plugin.
|
308
|
-
|
309
|
-
* Sequel.virtual_row was added allowing you to easily use the
|
310
|
-
VirtualRow support outside of select, order, and filter calls:
|
311
|
-
|
312
|
-
net_benefit = Sequel.virtual_row{revenue > cost}
|
313
|
-
good_employee = Sequel.virtual_row{num_commendations > 0}
|
314
|
-
fire = ~net_benefit & ~good_employee
|
315
|
-
demote = ~net_benefit & good_employee
|
316
|
-
promote = net_benefit & good_employee
|
317
|
-
DB[:employees].filter(fire).update(:employed=>false)
|
318
|
-
DB[:employees].filter(demote).update(:rank=>:rank-1)
|
319
|
-
DB[:employees].filter(promote).update(:rank=>:rank+1)
|
320
|
-
|
321
|
-
* When Sequel wraps exception in its own classes (to provide database
|
322
|
-
independence), it now keeps the wrapped exception available in
|
323
|
-
a wrapped_exception accessor. This allows you to more easily
|
324
|
-
determine the wrapped exception class, without resorting to parsing
|
325
|
-
the exception message.
|
326
|
-
|
327
|
-
begin
|
328
|
-
DB.run('...')
|
329
|
-
rescue Sequel::DatabaseError => e
|
330
|
-
case e.wrapped_exception
|
331
|
-
when Mysql::Error
|
332
|
-
...
|
333
|
-
when PGError
|
334
|
-
...
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
* The MySQL adapter now supports a Dataset#split_multiple_result_sets
|
339
|
-
method that yields arrays of rows (one per result set), instead of
|
340
|
-
rows. This allows you to submit multiple statements at the same
|
341
|
-
time (or call a stored procedure that returns multiple result
|
342
|
-
sets), and know which rows are related to which result sets.
|
343
|
-
|
344
|
-
This violates a lot of Sequel's internal assumptions and should be
|
345
|
-
used with care. Existing row_procs are modified to work correctly,
|
346
|
-
but graphing will not work on these datasets.
|
347
|
-
|
348
|
-
* The ADO adapter now accepts a :conn_string option and uses that
|
349
|
-
as the full ADO connection string. This can be used to connect to
|
350
|
-
any datasource ADO supports, such as Microsoft Excel.
|
351
|
-
|
352
|
-
* The Microsoft SQL Server shared adapter now supports a
|
353
|
-
Database#server_version method.
|
354
|
-
|
355
|
-
* The Microsoft SQL Server shared adapter now supports updating and
|
356
|
-
deleting from joined datasets.
|
357
|
-
|
358
|
-
* The Microsoft SQL Server shared adapter now supports a
|
359
|
-
Dataset#output method that uses the OUTPUT clause.
|
360
|
-
|
361
|
-
* Model#_save now calls either Model#_insert or Model#_update for
|
362
|
-
inserting/updating the row in the database. This allows for easier
|
363
|
-
overriding when you want to allow creating and updating model
|
364
|
-
objects backed by a joined dataset.
|
365
|
-
|
366
|
-
* Dataset#graph now takes a :from_self_alias option specifying the
|
367
|
-
alias to use for the subselect created if the receiver is a joined
|
368
|
-
but not yet graphed dataset. It defaults to the first source table
|
369
|
-
in the receiver.
|
370
|
-
|
371
|
-
Other Improvements
|
372
|
-
------------------
|
373
|
-
|
374
|
-
* Typecasting model attributes is now done before checking existing
|
375
|
-
values, instead of after. Before, the code for the model attribute
|
376
|
-
setters would compare the given value to the existing entry. If it
|
377
|
-
didn't match, the value was typecasted and then assigned. That led
|
378
|
-
to the following situation:
|
379
|
-
|
380
|
-
a = Album[1]
|
381
|
-
a.num_tracks # => 10
|
382
|
-
params # => {'num_tracks'=>'10'}
|
383
|
-
a.set(params)
|
384
|
-
a.changed_columns # => [:num_tracks]
|
385
|
-
|
386
|
-
The new behavior typecasts the value first, and only sets it and
|
387
|
-
records the column as changed if it doesn't match the typecasted
|
388
|
-
value.
|
389
|
-
|
390
|
-
* Model#modified? is now always true if the record is new. modified?
|
391
|
-
indicates the instance's status relative to the database, and since
|
392
|
-
a new object is not yet in the database, and saving the object
|
393
|
-
would add it, the object is considered modified. A consequence of
|
394
|
-
this is that Model#save_changes now always saves if the object is
|
395
|
-
new.
|
396
|
-
|
397
|
-
If you want to check if there were changes to columns since the
|
398
|
-
object was first initialized, you should use
|
399
|
-
!changed_columns.empty?, which was the historical way to handle
|
400
|
-
the situation.
|
401
|
-
|
402
|
-
* The DataObjects (do) adpater now supports DataObjects 0.10.
|
403
|
-
|
404
|
-
* Dataset#select_more and Dataset#order_more no longer affect the
|
405
|
-
receiver. They are supposed to just return a modified copy of the
|
406
|
-
receiver instead of modifying the receiver itself. For a few
|
407
|
-
versions they have been broken in that they modified the receiver
|
408
|
-
in addition to returning a modified copy.
|
409
|
-
|
410
|
-
* Performance was increased for execution of prepared statements
|
411
|
-
with multiple bound variables on MySQL.
|
412
|
-
|
413
|
-
* On MySQL, database errors raised when preparing statements or
|
414
|
-
setting bound variable values are now caught and raised as
|
415
|
-
Sequel::DatabaseErrors.
|
416
|
-
|
417
|
-
* On MySQL, more types of disconnection errors are detected.
|
418
|
-
|
419
|
-
* When altering columns in MySQL, options such as :unsigned,
|
420
|
-
:elements, and :size that are given in the call are now respected.
|
421
|
-
|
422
|
-
* MySQL enum defaults are now handled correctly in the schema dumper.
|
423
|
-
|
424
|
-
* The schema dumper no longer attempts to use unparseable defaults
|
425
|
-
as literals on MySQL, since MySQL does not provide defaults as
|
426
|
-
valid literals.
|
427
|
-
|
428
|
-
* The emulated offset support in the shared Microsoft SQL Server
|
429
|
-
adapter now works better with model classes (or any datasets with
|
430
|
-
row_procs).
|
431
|
-
|
432
|
-
* Microsoft SQL Server now supports using the WITH clause in delete,
|
433
|
-
update, and insert calls.
|
434
|
-
|
435
|
-
* Parsed indexes when connecting to Microsoft SQL Server via JDBC no
|
436
|
-
longer include primary key indexes.
|
437
|
-
|
438
|
-
* Dataset#insert_select now returns nil if disable_insert_returning
|
439
|
-
is used in the shared PostgreSQL adapter. This makes it work as
|
440
|
-
expected with model object creation.
|
441
|
-
|
442
|
-
* Calling Model.set_primary_key with an array of symbols to set
|
443
|
-
a composite primary key is now supported. You can also provide
|
444
|
-
multiple symbol arguments to do the same thing. Before, specifying
|
445
|
-
an array of symbols broke the Model.[] optimization.
|
446
|
-
|
447
|
-
* Literalization of timezones in timestamps now works correctly on
|
448
|
-
Oracle.
|
449
|
-
|
450
|
-
* __FILE__ and __LINE__ are now used everywhere that eval is called
|
451
|
-
with a string, which makes for better backtraces.
|
452
|
-
|
453
|
-
* The native MySQL adapter now correctly handles returning before
|
454
|
-
yielding all result sets. Previously, this caused a commands out
|
455
|
-
of sync error.
|
456
|
-
|
457
|
-
* Table names in common table expressions are now quoted.
|
458
|
-
|
459
|
-
* The Oracle adapter's Dataset#except now accepts a hash, giving it
|
460
|
-
the same API as the default Dataset#except.
|
461
|
-
|
462
|
-
* When connecting to Microsoft SQL Server via ADO, allow
|
463
|
-
Dataset#insert to take multiple arguments.
|
464
|
-
|
465
|
-
* Fractional timestamps are no longer used on ODBC.
|
466
|
-
|
467
|
-
* Schema parsing now works on MSSQL when the database is set to not
|
468
|
-
quote identifiers.
|
469
|
-
|
470
|
-
* Timezone offsets are no longer used on Microsoft SQL Server, since
|
471
|
-
they only work for the datetimeoffset type.
|
472
|
-
|
473
|
-
* Only 3 fractional digits in timestamps are used in Microsoft SQL
|
474
|
-
Server, since an error is raised if the use the datetime type
|
475
|
-
with more than that.
|
476
|
-
|
477
|
-
* The integration test suite now has guards for expected failures
|
478
|
-
when run on known databases. Expected failures are marked as
|
479
|
-
pending.
|
480
|
-
|
481
|
-
Backwards Compatibility
|
482
|
-
-----------------------
|
483
|
-
|
484
|
-
* Graphing to an previously joined (but not graphed) dataset now
|
485
|
-
causes the receiver to be wrapped in a subselect, so if you
|
486
|
-
graph a dataset to a previously joined dataset, and then filter
|
487
|
-
the dataset referring to tables that were in the joined dataset
|
488
|
-
(other than the first table), the SQL produced will probably no
|
489
|
-
longer be valid. You should either filter the dataset before
|
490
|
-
graphing or use the name of the first source of the joined
|
491
|
-
dataset (which is what the subselected is aliased to) if filtering
|
492
|
-
afterward.
|
493
|
-
|
494
|
-
In certain cases, this change can cause tables to be aliased
|
495
|
-
differently, so if you were graphing previously joined datasets
|
496
|
-
and then filtering using the automatically generated aliases, you
|
497
|
-
might need to modify your code.
|
498
|
-
|
499
|
-
* The DataObjects (do) adpater no longer supports DataObjects 0.9.x.
|
500
|
-
|
501
|
-
* The Dataset#virtual_row_block_call private instance method has
|
502
|
-
been removed.
|
503
|
-
|
504
|
-
* Sequel's timezone support was significantly refactored, so if you
|
505
|
-
had any custom modifications to the timezone support, they might
|
506
|
-
need to be refactored as well.
|
507
|
-
|
508
|
-
* The SQL generation code was significantly refactored, so if you
|
509
|
-
had any custom modifications in that area, you might need to
|
510
|
-
refactor as well.
|