sequel 5.6.0 → 5.7.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.
- 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.4.0.txt
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
New Plugins
|
|
2
|
-
-----------
|
|
3
|
-
|
|
4
|
-
* A nested_attributes plugin was added allowing you to modify
|
|
5
|
-
associated objects directly through a model object, similar to
|
|
6
|
-
ActiveRecord's Nested Attributes.
|
|
7
|
-
|
|
8
|
-
Artist.plugin :nested_attributes
|
|
9
|
-
Artist.one_to_many :albums
|
|
10
|
-
Artist.nested_attributes :albums
|
|
11
|
-
a = Artist.new(:name=>'YJM',
|
|
12
|
-
:albums_attributes=>[{:name=>'RF'}, {:name=>'MO'}])
|
|
13
|
-
# No database activity yet
|
|
14
|
-
|
|
15
|
-
a.save # Saves artist and both albums
|
|
16
|
-
a.albums.map{|x| x.name} # ['RF', 'MO']
|
|
17
|
-
|
|
18
|
-
It takes most of the same options as ActiveRecord, as well as a
|
|
19
|
-
a few additional options:
|
|
20
|
-
|
|
21
|
-
* :destroy - Allow destruction of nested records.
|
|
22
|
-
* :limit - For *_to_many associations, a limit on the number of
|
|
23
|
-
records that will be processed, to prevent denial of service
|
|
24
|
-
attacks.
|
|
25
|
-
* :remove - Allow disassociation of nested records (can remove the
|
|
26
|
-
associated object from the parent object, but not destroy the
|
|
27
|
-
associated object).
|
|
28
|
-
* :strict - Set to false to not raise an error message if a primary
|
|
29
|
-
key is provided in a record, but it doesn't match an existing
|
|
30
|
-
associated object.
|
|
31
|
-
|
|
32
|
-
If a block is provided, it is passed each nested attribute hash.
|
|
33
|
-
If the hash should be ignored, the block should return anything
|
|
34
|
-
except false or nil.
|
|
35
|
-
|
|
36
|
-
* A timestamps plugin was added for automatically adding
|
|
37
|
-
before_create and before_update hooks for setting values on
|
|
38
|
-
timestamp columns. There are a couple of existing external
|
|
39
|
-
plugins that handle timestamps, but the implementations are
|
|
40
|
-
suboptimal. The new built-in plugin supports the following
|
|
41
|
-
options (with the default in parentheses):
|
|
42
|
-
|
|
43
|
-
* :create - The field to hold the create timestamp (:created_at)
|
|
44
|
-
* :force - Whether to overwrite an existing create timestamp
|
|
45
|
-
(false)
|
|
46
|
-
* :update - The field to hold the update timestamp (:updated_at)
|
|
47
|
-
* :update_on_create - Whether to set the update timestamp to the
|
|
48
|
-
create timestamp when creating (false)
|
|
49
|
-
|
|
50
|
-
* An instance_hooks plugin was added for adding hooks to specific
|
|
51
|
-
w
|
|
52
|
-
model instances:
|
|
53
|
-
|
|
54
|
-
obj = Model.new
|
|
55
|
-
obj.after_save_hook{do_something}
|
|
56
|
-
obj.save # calls do_something after the obj has been saved
|
|
57
|
-
|
|
58
|
-
All of the standard hooks are supported, except for
|
|
59
|
-
after_initialize. Instance level before hooks are executed in
|
|
60
|
-
reverse order of addition before calling super. Instance level
|
|
61
|
-
after hooks are executed in order of addition after calling super.
|
|
62
|
-
If any of the instance level before hook blocks return false, no
|
|
63
|
-
more instance level before hooks are called and false is returned.
|
|
64
|
-
|
|
65
|
-
Instance level hooks are cleared when the object is saved
|
|
66
|
-
successfully.
|
|
67
|
-
|
|
68
|
-
* A boolean_readers plugin was added for creating attribute? methods
|
|
69
|
-
for boolean columns. This can provide a nicer API:
|
|
70
|
-
|
|
71
|
-
obj = Model[1]
|
|
72
|
-
obj.active # Sequel default column reader
|
|
73
|
-
obj.active? # Using the boolean_readers plugin
|
|
74
|
-
|
|
75
|
-
You can provide a block when loading the plugin to change the
|
|
76
|
-
criteria used to determine if the column is boolean:
|
|
77
|
-
|
|
78
|
-
Sequel::Model.plugin(:boolean_readers) do |c|
|
|
79
|
-
db_schema[c][:db_type] =~ /\Atinyint/
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
This may be useful if you are using MySQL and have some tinyint
|
|
83
|
-
columns that represent booleans and others that represent integers.
|
|
84
|
-
You can turn the convert_tinyint_to_bool setting off and use the
|
|
85
|
-
attribute methods for the integer value and the attribute? methods
|
|
86
|
-
for the boolean value.
|
|
87
|
-
|
|
88
|
-
Other New Features
|
|
89
|
-
------------------
|
|
90
|
-
|
|
91
|
-
* Sequel now has support for converting Time/DateTime to local or UTC
|
|
92
|
-
time upon storage, retrieval, or typecasting.
|
|
93
|
-
|
|
94
|
-
There are three different timezone settings:
|
|
95
|
-
|
|
96
|
-
* Sequel.database_timezone - The timezone that timestamps use in
|
|
97
|
-
the database. If the database returns a time without an offset,
|
|
98
|
-
it is assumed to be in this timezone.
|
|
99
|
-
|
|
100
|
-
* Sequel.typecast_timezone - Similar to database_timezone, but used
|
|
101
|
-
for typecasting data from a source other than the database. This
|
|
102
|
-
is currently only used by the model typecasting code.
|
|
103
|
-
|
|
104
|
-
* Sequel.application_timezone - The timezone that the application
|
|
105
|
-
wants to deal with. All Time/DateTime objects are converted into
|
|
106
|
-
this timezone upon retrieval from the database.
|
|
107
|
-
|
|
108
|
-
Unlike most things in Sequel, these are only global settings, you
|
|
109
|
-
cannot change them per database. There are only three valid
|
|
110
|
-
timezone settings:
|
|
111
|
-
|
|
112
|
-
* nil (the default) - Don't do any timezone conversion. This is
|
|
113
|
-
the historical behavior.
|
|
114
|
-
|
|
115
|
-
* :local - Convert to local time/Consider time to be in local time.
|
|
116
|
-
|
|
117
|
-
* :utc - Convert to UTC/Consider time to be in UTC.
|
|
118
|
-
|
|
119
|
-
So if you want to store times in the database as UTC, but deal with
|
|
120
|
-
them in local time in the application:
|
|
121
|
-
|
|
122
|
-
Sequel.application_timezone = :local
|
|
123
|
-
Sequel.database_timezone = :utc
|
|
124
|
-
|
|
125
|
-
If you want to set all three timezones to the same value:
|
|
126
|
-
|
|
127
|
-
Sequel.default_timezone = :utc
|
|
128
|
-
|
|
129
|
-
There are three conversion methods that are called:
|
|
130
|
-
|
|
131
|
-
* Sequel.database_to_application_timestamp - Called on time objects
|
|
132
|
-
coming out of the database. If the object coming out of the
|
|
133
|
-
database (usually a string) does not have an offset, assume it is
|
|
134
|
-
already in the database_timezone. Return a Time/DateTime object
|
|
135
|
-
(depending on Sequel.datetime_class), in the application_timzone.
|
|
136
|
-
|
|
137
|
-
* Sequel.application_to_database_timestamp - Used when literalizing
|
|
138
|
-
Time/DateTime objects into an SQL string. Converts the object to
|
|
139
|
-
the database_timezone before literalizing them.
|
|
140
|
-
|
|
141
|
-
* Sequel.typecast_to_application_timestamp - Called when
|
|
142
|
-
typecasting objects for model datetime columns. If the object
|
|
143
|
-
being typecasted does not already have an offset, assume it is
|
|
144
|
-
already in the typecast_timezone. Return a Time/DateTime object
|
|
145
|
-
(depending on Sequel.datetime_class), in the
|
|
146
|
-
application_timezone.
|
|
147
|
-
|
|
148
|
-
Sequel does not yet support named timezones or per thread
|
|
149
|
-
modification of the timezone (for showing all timestamps in the
|
|
150
|
-
current user's timezone). Extensions to support both features are
|
|
151
|
-
planned for a future version.
|
|
152
|
-
|
|
153
|
-
* Dataset#truncate was added for truncating tables. Truncate allows
|
|
154
|
-
for fast removal of all rows in a table.
|
|
155
|
-
|
|
156
|
-
* Sequel now supports typecasting a hash to date, time, and datetime
|
|
157
|
-
types. This allows easy usage of Sequel with forms that split
|
|
158
|
-
the entry of these database types into separate from fields.
|
|
159
|
-
With this code, you can just have field names like:
|
|
160
|
-
|
|
161
|
-
date[year]
|
|
162
|
-
date[month]
|
|
163
|
-
date[day]
|
|
164
|
-
|
|
165
|
-
Rack will parse that into:
|
|
166
|
-
|
|
167
|
-
{'date'=>{'year'=>?, 'month'=>?, 'day'=>?}}
|
|
168
|
-
|
|
169
|
-
So then you can do:
|
|
170
|
-
|
|
171
|
-
obj.date = params['date']
|
|
172
|
-
# or
|
|
173
|
-
obj.set(params)
|
|
174
|
-
|
|
175
|
-
* validates_unique now takes a block that can be used to scope the
|
|
176
|
-
uniqueness constraint. This allows you to easily set up uniqueness
|
|
177
|
-
validations that are only necessary in a given scope. For example,
|
|
178
|
-
a validation on username, but only for active users (as inactive
|
|
179
|
-
users are soft deleted but remain in the table). You just pass a
|
|
180
|
-
block to validates_unique:
|
|
181
|
-
|
|
182
|
-
validates_unique(:name){|ds| ds.filter(:active)}
|
|
183
|
-
|
|
184
|
-
* The serialization plugin now supports json.
|
|
185
|
-
|
|
186
|
-
* Sequel now supports generic concepts of
|
|
187
|
-
CURRENT_{DATE,TIME,TIMESTAMP}. Most databases support these SQL
|
|
188
|
-
concepts, but not all, and some implementations act differently.
|
|
189
|
-
|
|
190
|
-
The Sequel::SQL::Constants module holds the three constants,
|
|
191
|
-
which are instances of SQL::Constant, an SQL::GenericExpression
|
|
192
|
-
subclass. This module is included in Sequel, so you can reference
|
|
193
|
-
the constants more easily (e.g. Sequel::CURRENT_TIMESTAMP).
|
|
194
|
-
It's separated out into a separate module so that you can just
|
|
195
|
-
include that module in the top level scope, allowing you to
|
|
196
|
-
reference the constants directly (e.g. CURRENT_TIMESTAMP).
|
|
197
|
-
|
|
198
|
-
DB[:events].filter{date < ::Sequel::CURRENT_DATE}
|
|
199
|
-
# or:
|
|
200
|
-
include Sequel::SQL::Constants
|
|
201
|
-
DB[:events].filter{date < ::CURRENT_DATE}
|
|
202
|
-
|
|
203
|
-
* Database#run was added for executing arbitrary SQL on a database.
|
|
204
|
-
It's an alias for Database#<<, but it allows for a nicer API inside
|
|
205
|
-
migrations, since you can now do:
|
|
206
|
-
|
|
207
|
-
run 'SQL'
|
|
208
|
-
|
|
209
|
-
instead of:
|
|
210
|
-
|
|
211
|
-
self << 'SQL'
|
|
212
|
-
|
|
213
|
-
You can also provide a :server option to run the SQL on the
|
|
214
|
-
given server/shard:
|
|
215
|
-
|
|
216
|
-
run 'SQL', :server=>:shard1
|
|
217
|
-
|
|
218
|
-
* Sequel::Model() can now take a database argument in addition to
|
|
219
|
-
a symbol or dataset argument. If a database is given, it'll create
|
|
220
|
-
an anonymous subclass attached to the given database. Other changes
|
|
221
|
-
were made to allow the following code to work:
|
|
222
|
-
|
|
223
|
-
class Item < Sequel::Model(DB2)
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
That will work correctly assuming a table named items in DB2.
|
|
227
|
-
|
|
228
|
-
* Dataset#ungrouped was added for removing a grouping from an
|
|
229
|
-
existing dataset. Also, Dataset#group when called with no arguments
|
|
230
|
-
or with a nil argument also removes any existing grouping instead
|
|
231
|
-
of resulting in invalid SQL.
|
|
232
|
-
|
|
233
|
-
* Model#modified? was added, letting you know if the model has been
|
|
234
|
-
modified. If the model hasn't been modified, calling
|
|
235
|
-
Model#save_changes will do nothing.
|
|
236
|
-
|
|
237
|
-
* SQL::OrderedExpression now supports #asc, #desc, and #invert.
|
|
238
|
-
|
|
239
|
-
Other Improvements
|
|
240
|
-
------------------
|
|
241
|
-
|
|
242
|
-
* The serialization and lazy_attribute plugins now add accessor
|
|
243
|
-
methods to a module included in the class, instead of to the
|
|
244
|
-
model class itself. This allows the methods to be overridden
|
|
245
|
-
in the class and work well with super, as well for the plugins
|
|
246
|
-
to work together on the same column. Make sure the
|
|
247
|
-
lazy_attributes accessor is setup before the serialization
|
|
248
|
-
accessor if you want to have a lazy serialized column.
|
|
249
|
-
|
|
250
|
-
* Calling the add_* method for many_to_many association now saves the
|
|
251
|
-
record if the record is new. This makes it operate more similarly
|
|
252
|
-
to one_to_many associations. Previously, it raised an Error.
|
|
253
|
-
|
|
254
|
-
* Dataset#import now works correctly when called with a dataset.
|
|
255
|
-
Previously, it generated incorrect SQL.
|
|
256
|
-
|
|
257
|
-
* The JDBC adapter now converts byte arrays to/from SQL::Blob.
|
|
258
|
-
|
|
259
|
-
* The JDBC adapter now attempts to bind unknown types using
|
|
260
|
-
setObject instead of raising, so it can work with native Java
|
|
261
|
-
objects. It also binds boolean parameters correctly.
|
|
262
|
-
|
|
263
|
-
* Using multiple emulated ALTER TABLE statements (such as
|
|
264
|
-
drop_column) in a single alter_table block now works correctly
|
|
265
|
-
on SQLite.
|
|
266
|
-
|
|
267
|
-
* Database#indexes now works on JDBC for tables in a non-default
|
|
268
|
-
schema. It also now properly detects unique indexes on MSSQL.
|
|
269
|
-
|
|
270
|
-
* Database#schema on JDBC now accepts a :schema option. Also,
|
|
271
|
-
returned schema hashes now include a :column_size entry specifying
|
|
272
|
-
the maximum length/precision for the column, since the
|
|
273
|
-
:db_type entry doesn't have contain the information on JDBC.
|
|
274
|
-
|
|
275
|
-
* Datasets without tables now work correctly on Oracle, so things
|
|
276
|
-
like DB.get(...) now work.
|
|
277
|
-
|
|
278
|
-
* A descriptive error message is given if you attempt to use
|
|
279
|
-
Sequel with the mysql.rb driver (which Sequel doesn't support).
|
|
280
|
-
|
|
281
|
-
* The postgres adapter now works correctly with a modified
|
|
282
|
-
postgres-pr that raises PGErrors instead of RuntimeErrors
|
|
283
|
-
(e.g. http://github.com/jeremyevans/postgres-pr).
|
|
284
|
-
|
|
285
|
-
* You now get a Sequel::InvalidOperation instead of a NoMethodError
|
|
286
|
-
if you attempt to update a dataset without a table.
|
|
287
|
-
|
|
288
|
-
* The inflection support has been modified to reduce code
|
|
289
|
-
duplication.
|
|
290
|
-
|
|
291
|
-
Backwards Compatibility
|
|
292
|
-
-----------------------
|
|
293
|
-
|
|
294
|
-
* Sequel now includes fractional seconds in timestamps for all
|
|
295
|
-
adapters except MySQL. It's possible that this may break
|
|
296
|
-
timestamp columns for databases that are not regularly tested.
|
|
297
|
-
|
|
298
|
-
* Sequel now includes timezone values in timestamps on Microsoft
|
|
299
|
-
SQL Server, Oracle, PostgreSQL and SQLite. The modification for
|
|
300
|
-
SQLite is probably the biggest cause for concern, since SQLite
|
|
301
|
-
stores times as text. If you have an SQLite database that uses
|
|
302
|
-
timestamps and is accessed by something other than Sequel, you
|
|
303
|
-
should make sure that it works with the timestamp format that
|
|
304
|
-
Sequel now uses.
|
|
305
|
-
|
|
306
|
-
* The default timestamp format used by Sequel now uses a space
|
|
307
|
-
instead of 'T' between the date and time parts, which could
|
|
308
|
-
possibly affect some databases that are not regularly tested.
|
|
309
|
-
|
|
310
|
-
* Attempting to insert into a grouped dataset or a dataset that
|
|
311
|
-
selects from multiple tables will now raise an Error. Previously,
|
|
312
|
-
it would ignore any GROUP or JOIN settings and generate bad SQL if
|
|
313
|
-
there were multiple FROM tables.
|
|
314
|
-
|
|
315
|
-
* Database#<< now always returns nil. Before, the return value was
|
|
316
|
-
adapter dependent.
|
|
317
|
-
|
|
318
|
-
* ODBC::Time and ODBC::DateTime values are now converted to the
|
|
319
|
-
Sequel.datetime_class. Before, ODBC::Time used Time and
|
|
320
|
-
ODBC::DateTime used DateTime regardless of the
|
|
321
|
-
Sequel.datetime_class setting.
|
|
322
|
-
|
|
323
|
-
* The default inflections were modified, fixing some obvious errors
|
|
324
|
-
and possibly changing some existing inflections. Further changes
|
|
325
|
-
to the default inflections are unlikely.
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
= New Features
|
|
2
|
-
|
|
3
|
-
* Sequel now has vastly improved support for Microsoft Access.
|
|
4
|
-
|
|
5
|
-
* Sequel now supports the CUBRID database, with a cubrid adapter
|
|
6
|
-
that uses the cubrid gem, and a jdbc/cubrid adapter for accessing
|
|
7
|
-
CUBRID via JDBC on JRuby.
|
|
8
|
-
|
|
9
|
-
* The association_pks plugin now supports composite keys.
|
|
10
|
-
|
|
11
|
-
* Database#transaction now accepts a :disconnect=>:retry option,
|
|
12
|
-
in which case it will automatically retry the block if it
|
|
13
|
-
detects a disconnection. This is potentially dangerous, and
|
|
14
|
-
should only be used if the entire block is idempotent. There
|
|
15
|
-
is also no checking against an infinite retry loop.
|
|
16
|
-
|
|
17
|
-
* SQL::CaseExpression#with_merged_expression has been added, for
|
|
18
|
-
converting a CaseExpression with an associated expression to
|
|
19
|
-
one without an associated expression, by merging the expression
|
|
20
|
-
into each condition.
|
|
21
|
-
|
|
22
|
-
= Other Improvements
|
|
23
|
-
|
|
24
|
-
* Sequel now quotes arguments/columns in common table expressions.
|
|
25
|
-
|
|
26
|
-
* Sequel now handles nil values correctly in the pg_row extension.
|
|
27
|
-
|
|
28
|
-
* Sequel::Postgres::HStore instances can now be marshalled.
|
|
29
|
-
|
|
30
|
-
* Sequel now uses clob for String :text=>true types on databases that
|
|
31
|
-
don't support a text type.
|
|
32
|
-
|
|
33
|
-
* On PostgreSQL, Sequel now quotes channel identifier names when using
|
|
34
|
-
LISTEN/NOTIFY.
|
|
35
|
-
|
|
36
|
-
* On PostgreSQL, Sequel now correctly handles the case where named
|
|
37
|
-
type conversion procs have been added before the Database object is
|
|
38
|
-
instantiated.
|
|
39
|
-
|
|
40
|
-
* On DB2, Sequel now explicitly sets NOT NULL for unique constraint
|
|
41
|
-
columns instead of foreign key columns. DB2 does not allow columns
|
|
42
|
-
in unique constraints to be NULL, but does allow foreign key columns
|
|
43
|
-
to be NULL.
|
|
44
|
-
|
|
45
|
-
* In the oracle adapter, clob values are now returned as ruby strings
|
|
46
|
-
upon retrieval.
|
|
47
|
-
|
|
48
|
-
* Sequel now detects more types of disconnections in the postgres,
|
|
49
|
-
mysql, and mysql2 adapters.
|
|
50
|
-
|
|
51
|
-
* If a database provides a default column value that isn't a ruby
|
|
52
|
-
string, it is used directly as the ruby default, instead of causing
|
|
53
|
-
the schema parsing to fail.
|
|
54
|
-
|
|
55
|
-
= Backwards Compatibility
|
|
56
|
-
|
|
57
|
-
* Code using Sequel's oracle adapter that expected clob values to be
|
|
58
|
-
returned as OCI8::CLOB instances needs to be modified to work with
|
|
59
|
-
ruby strings.
|
|
60
|
-
|
|
61
|
-
* Because Sequel now quotes column names in common table expressions,
|
|
62
|
-
those names are now case sensitive, which could break certain poorly
|
|
63
|
-
coded queries. Similar issues exist with the quoting of channel
|
|
64
|
-
identifier names in LISTEN/NOTIFY on PostgreSQL.
|
|
65
|
-
|
|
66
|
-
* The private Database#requires_return_generated_keys? method
|
|
67
|
-
has been removed from the jdbc adapter. Custom jdbc subadapters
|
|
68
|
-
relying on this method should override the private
|
|
69
|
-
Database#execute_statement_insert method instead to ensure that
|
|
70
|
-
RETURN_GENERATED_KEYS is used for insert statements.
|
|
71
|
-
|
|
72
|
-
* The private Dataset#argument_list and #argument_list_append methods
|
|
73
|
-
have been removed.
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
= New Features
|
|
2
|
-
|
|
3
|
-
* A connection_validator extension has been added, which
|
|
4
|
-
automatically determines if connections checked out from the pool
|
|
5
|
-
are still valid. If they are not valid, the connection is
|
|
6
|
-
disconnected and another connection is used automatically,
|
|
7
|
-
transparent to user code.
|
|
8
|
-
|
|
9
|
-
Checking if connections are valid requires a query, so this
|
|
10
|
-
extension causes a performance hit. For that reason, connections
|
|
11
|
-
are only checked by default if they have been inactive for more than
|
|
12
|
-
a configured amount of time (1 hour by default). You can choose to
|
|
13
|
-
validate connections on every checkout via:
|
|
14
|
-
|
|
15
|
-
DB.pool.connection_validation_timeout = -1
|
|
16
|
-
|
|
17
|
-
However, this can cause a substantial performance hit unless you are
|
|
18
|
-
purposely using coarse connection checkouts via manual calls to
|
|
19
|
-
Database#synchronize (for example, in a Rack middleware). Using
|
|
20
|
-
coarse checkouts can greatly reduce the amount of concurrency that
|
|
21
|
-
Sequel supports (for example, limiting the number of concurrent
|
|
22
|
-
requests to the number of database connections), so this method is
|
|
23
|
-
not without its tradeoffs.
|
|
24
|
-
|
|
25
|
-
* Sequel.delay has been added for a generic form of delayed
|
|
26
|
-
evaluation. This method takes a block and delays evaluating it
|
|
27
|
-
until query literalization. By default, Sequel evaluates most
|
|
28
|
-
arguments immediately:
|
|
29
|
-
|
|
30
|
-
foo = 1
|
|
31
|
-
ds = DB[:bar].where(:baz=>foo)
|
|
32
|
-
# SELECT * FROM bar WHERE (baz = 1)
|
|
33
|
-
foo = 2
|
|
34
|
-
ds
|
|
35
|
-
# SELECT * FROM bar WHERE (baz = 1)
|
|
36
|
-
|
|
37
|
-
Using Sequel.delay, you can delay the evaluation:
|
|
38
|
-
|
|
39
|
-
foo = 1
|
|
40
|
-
ds = DB[:bar].where(:baz=>Sequel.delay{foo})
|
|
41
|
-
# SELECT * FROM bar WHERE (baz = 1)
|
|
42
|
-
foo = 2
|
|
43
|
-
ds
|
|
44
|
-
# SELECT * FROM bar WHERE (baz = 2)
|
|
45
|
-
|
|
46
|
-
* Sequel now supports the :unlogged option when creating tables on
|
|
47
|
-
PostgreSQL, to create an UNLOGGED table.
|
|
48
|
-
|
|
49
|
-
* On SQLite, Database#transaction now supports a :mode option for
|
|
50
|
-
setting up IMMEDIATE/EXCLUSIVE SQLite transactions. Sequel also
|
|
51
|
-
supports a Database#transaction_mode accessor for setting the
|
|
52
|
-
default transaction mode on SQLite.
|
|
53
|
-
|
|
54
|
-
* Most pg_* extension objects (e.g. PGArray) now support the #as
|
|
55
|
-
method for creating an SQL::AliasedExpression object.
|
|
56
|
-
|
|
57
|
-
* The single_table_inheritance plugin now supports non-bijective
|
|
58
|
-
mappings. In lay terms, this means that a one-to-one mapping
|
|
59
|
-
of column values to classes is no longer required. You can now
|
|
60
|
-
have multiple column values that map to a single class in the
|
|
61
|
-
:model_map option, and specify a :key_chooser option to choose
|
|
62
|
-
which column value to use for the given model class.
|
|
63
|
-
|
|
64
|
-
* The touch plugin now handles the touching of many_to_many
|
|
65
|
-
associations, and other associations that use joined datasets.
|
|
66
|
-
|
|
67
|
-
* ConnectionPool#pool_type has been added. It returns a symbol
|
|
68
|
-
representing the type of connection pool in use (similar to
|
|
69
|
-
Database#database_type).
|
|
70
|
-
|
|
71
|
-
* Database#valid_connection? has been added for checking if a given
|
|
72
|
-
connection is still valid.
|
|
73
|
-
|
|
74
|
-
* Database#disconnect_connection is now part of the public API, and
|
|
75
|
-
can be used to disconnect a given connection.
|
|
76
|
-
|
|
77
|
-
= Other Improvements
|
|
78
|
-
|
|
79
|
-
* Uniqueness validation now correctly handles nil values.
|
|
80
|
-
Previously, it checked the underlying table for other rows where
|
|
81
|
-
the column IS NULL, but that is incorrect behavior. Sequel's new
|
|
82
|
-
(correct) behavior is to skip the uniqueness check if the column
|
|
83
|
-
is nil.
|
|
84
|
-
|
|
85
|
-
* Foreign key parsing is now supported on Microsoft SQL Server.
|
|
86
|
-
|
|
87
|
-
* Dataset#reverse and #reverse_order now accept virtual row blocks.
|
|
88
|
-
|
|
89
|
-
* Changing the name of the primary key column, and possibly other
|
|
90
|
-
schema changes on the primary key column, are now supported on
|
|
91
|
-
MySQL.
|
|
92
|
-
|
|
93
|
-
* Primary key columns are now specifically marked as NOT NULL on
|
|
94
|
-
SQLite, as non-integer primary keys on SQLite are not considered
|
|
95
|
-
NOT NULL by default.
|
|
96
|
-
|
|
97
|
-
* Failure to create a native prepared statement is now handled
|
|
98
|
-
better in the postgres, mysql, and mysql2 adapters.
|
|
99
|
-
|
|
100
|
-
* Firebird now emulates selecting data without an underlying table
|
|
101
|
-
(e.g. DB.get(1)).
|
|
102
|
-
|
|
103
|
-
* Finding the name of the constraint that sets column defaults on
|
|
104
|
-
Microsoft SQL Server now works correctly on JRuby 1.7.
|
|
105
|
-
|
|
106
|
-
* An additional type of disconnect error is now recognized in the
|
|
107
|
-
jdbc/sqlserver adapter.
|
|
108
|
-
|
|
109
|
-
* Many adapters have been fixed so that they don't raise an exception
|
|
110
|
-
if trying to disconnect an already disconnected connection.
|
|
111
|
-
|
|
112
|
-
* Many adapters have been fixed so that
|
|
113
|
-
Database#log_connection_execute logs and executes the given SQL
|
|
114
|
-
on the connection.
|
|
115
|
-
|
|
116
|
-
* Many adapters have been fixed so that
|
|
117
|
-
Database#database_error_classes returns an array of database
|
|
118
|
-
exception classes for that adapter.
|
|
119
|
-
|
|
120
|
-
* Database#log_exception now handles a nil exception message.
|
|
121
|
-
|
|
122
|
-
* Dataset#limit(nil, nil) now resets offset in addition to limit, but
|
|
123
|
-
you should still use Dataset#unlimited instead.
|
|
124
|
-
|
|
125
|
-
* A bin/sequel usage quide has been added to the documentation.
|
|
126
|
-
|
|
127
|
-
= Backwards Compatibility
|
|
128
|
-
|
|
129
|
-
* Sequel now treats clob columns as strings instead of blobs
|
|
130
|
-
(except on DB2 when use_clob_as_blob = true). This can make it
|
|
131
|
-
so the values are returned as strings instead of SQL::Blob values.
|
|
132
|
-
Since SQL::Blob is a String subclass, this generally will
|
|
133
|
-
not affect user code unless you are passing the values as input
|
|
134
|
-
to a separate blob column.
|
|
135
|
-
|
|
136
|
-
* The Database <-> ConnectionPool interface was completely changed.
|
|
137
|
-
Sequel no longer supports custom connection procs or disconnection
|
|
138
|
-
procs in the connection pools. The :disconnection_proc Database
|
|
139
|
-
option is no longer respected, and blocks passed to Database.new
|
|
140
|
-
are now ignored.
|
|
141
|
-
|
|
142
|
-
This change should not be user-visible, but if you had any code
|
|
143
|
-
that was monkeying with the connection pool internals, you may
|
|
144
|
-
need to modify it.
|
|
145
|
-
|
|
146
|
-
* Code that was using the uniqueness check to also check for presence
|
|
147
|
-
should add a separate check for presence. Such code was broken,
|
|
148
|
-
as it only worked if there was already a NULL column value in the
|
|
149
|
-
table. If you were relying on this broken behavior, you should
|
|
150
|
-
clean up the NULL data in the column and then mark the database
|
|
151
|
-
column as NOT NULL.
|
|
152
|
-
|
|
153
|
-
* If you have code that specifically abuses the fact that non-integer
|
|
154
|
-
primary keys on SQLite allow NULL values by default, it will no
|
|
155
|
-
longer work.
|