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,151 +0,0 @@
1
- New Features
2
- ------------
3
-
4
- * Dataset#each_server was added, allowing you to run the same query
5
- (most likely insert/update/delete) on all shards. This is useful
6
- if you have a sharded database but have lookup tables that should
7
- be identical on all shards. It works by yielding copies of the
8
- current dataset that are tied to each server/shard:
9
-
10
- DB[:table].filter(:id=>1).each_server do |ds|
11
- ds.update(:name=>'foo')
12
- end
13
-
14
- * Database#each_server was added, allowing you to run schema
15
- modification methods on all shards. It works by yielding a
16
- new Sequel::Database object for each shard, that will connect to
17
- only that shard:
18
-
19
- DB.each_server do |db|
20
- db.create_table(:t){Integer :num}
21
- end
22
-
23
- * You can now add and remove servers/shards from the connection
24
- pool while Sequel is running:
25
-
26
- DB.add_servers(:shard1=>{:host=>'s1'}, :shard2=>{:host=>'s2'})
27
- DB.remove_servers(:shard1, :shard2)
28
-
29
- * When you attempt to disconnect from a server that has connections
30
- currently in use, Sequel will now schedule those connections to
31
- be disconnected when they are returned to the pool. Previously,
32
- Sequel disconnected available connections, but ignored connections
33
- currently in use, so it wasn't possible to guarantee complete
34
- disconnection from the server. Even with this new feature, you can
35
- only guarantee eventual disconnection, since disconnection of
36
- connections in use happens asynchronously.
37
-
38
- * Database#disconnect now accepts a :servers option specifying the
39
- server(s) from which to disconnect. This should be a symbol or
40
- array of symbols representing servers/shards. Only those specified
41
- will be disconnected:
42
-
43
- DB.disconnect(:servers=>[:shard1, :shard2])
44
-
45
- * A validates_type validation was added to the validation_helpers
46
- plugin. It allows you to check that a given column contains
47
- the correct type. I can be helpful if you are also using the
48
- serialization plugin to store serialized ruby objects, by making
49
- sure that the objects are of the correct type (e.g. Hash):
50
-
51
- def validate
52
- validates_type(Hash, :options)
53
- end
54
-
55
- * Sequel::SQL::Expression#== is now supported for all expressions:
56
-
57
- :column.qualify(:table).cast(:type) == \
58
- :column.qualify(:table).cast(:type)
59
- # => true
60
- :column.qualify(:table).cast(:type) == \
61
- :other_column.qualify(:table).cast(:type)
62
- # => false
63
-
64
- * When using the generic File type to create blob columns on
65
- MySQL, you can specify the specific database type by using the
66
- :size option (with :tiny, :medium, and :long values recognized):
67
-
68
- DB.create_table(:docs){File :body, :size=>:long} # longblob
69
-
70
- * The mysql adapter will now default to using mysqlplus, falling
71
- back to use mysql. mysqlplus is significantly better for threaded
72
- code because queries do not block the entire interpreter.
73
-
74
- * The JDBC adapter is now able to detect certain types of disconnect
75
- errors.
76
-
77
- * ConnectionPool.servers and Database.servers were added, which
78
- return an array of symbols specifying the servers/shards in use.
79
-
80
- Other Improvements
81
- ------------------
82
-
83
- * The single-threaded connection pool now raises
84
- DatabaseConnectionErrors if unable to connect, so it now operates
85
- more similarly to the default connection pool.
86
-
87
- * The single-threaded connection pool now operates more similar
88
- to the default connection pool when given a nonexistent server.
89
-
90
- * PGErrors are now correctly converted to DatabaseErrors in the
91
- postgres adapter when preparing statements or executing prepared
92
- statements.
93
-
94
- * DatabaseDisconnectErrors are now raised correctly in the postgres
95
- adapter if the connection status is not OK after a query raises an
96
- error.
97
-
98
- * In the mysql adapter, multiple statements in a single query should
99
- now be handled correctly in the all cases, not just when using
100
- Dataset#each. So you can now submit multiple queries in a single
101
- string to Database#run.
102
-
103
- * Model object creation on Microsoft SQL Server 2000 once again
104
- works correctly. Previously, an optimization was used that was
105
- only supported on 2005+.
106
-
107
- * Backslashes are no longer doubled inside string literals when
108
- connecting to Microsoft SQL Server.
109
-
110
- * The ORDER clause now correctly comes after the HAVING clause on
111
- Microsoft SQL Server.
112
-
113
- * Sequel now checks that there is an active transaction before
114
- rolling back transactions on Microsoft SQL Server, since
115
- there are cases where Microsoft SQL Server will roll back
116
- transactions implicitly.
117
-
118
- * Blobs are now handled correctly when connecting to H2.
119
-
120
- * 64-bit integers are now handled correctly in JDBC prepared
121
- statements.
122
-
123
- * In the boolean_readers plugin, correctly handle columns not in
124
- the db_schema, and don't raise an error if the model's columns
125
- can't be determined.
126
-
127
- * In the identity_map plugin, remove instances from the cache if they
128
- are deleted or destroyed.
129
-
130
- Backwards Compatibility
131
- -----------------------
132
-
133
- * Dataset::FROM_SELF_KEEP_OPTS was merged into
134
- Dataset::NON_SQL_OPTIONS. While used in different places, they
135
- were used for the same purpose, and entries missing from one should
136
- have been included in the other.
137
-
138
- * The connection pool internals changed substantially. Now,
139
- ConnectionPool #allocated and #available_connections will return
140
- nil instead of an array or hash if they are called with a
141
- nonexistent server. These are generally only used internally,
142
- though they are part of the public API. #created_count and #size
143
- still return the size of the :default server when called with a
144
- nonexistent server, though.
145
-
146
- * The meta_eval and metaclass private methods were removed from
147
- Sequel::MetaProgramming (only the meta_def public method remains).
148
- If you want these methods, use the metaid gem.
149
-
150
- * The irregular ox->oxen pluralization rule was removed from the
151
- default inflections, as it screws up the more common box->boxes.
@@ -1,233 +0,0 @@
1
- New Features
2
- ------------
3
-
4
- * The ConnectionPool classes were refactored from 2 separate
5
- classes to a 5 class hierarchy, with one main class and 4
6
- subclasses, one for each combination of sharding and threading.
7
-
8
- The primary reason for this refactoring is to make it so that
9
- the user doesn't have to pay a performance penalty for sharding
10
- if they aren't using it. A connection pool that supports sharding
11
- is automatically used if the :servers option is used when setting
12
- up the database connection.
13
-
14
- In addition, the default connection pool no longer contains
15
- the code to schedule future disconnections of currently allocated
16
- connections. The sharded connection pool must be used if that
17
- feature is desired.
18
-
19
- The unsharded connection pools are about 25-30% faster than the
20
- sharded versions.
21
-
22
- * An optimistic_locking plugin was added to Sequel::Model. This
23
- plugin implements a simple database-independent locking mechanism
24
- to ensure that concurrent updates do not override changes:
25
-
26
- class Person < Sequel::Model
27
- plugin :optimistic_locking
28
- end
29
- p1 = Person[1]
30
- p2 = Person[1]
31
- # works
32
- p1.update(:name=>'Jim')
33
- # raises Sequel::Plugins::OptimisticLocking::Error
34
- p2.update(:name=>'Bob')
35
-
36
- In order for this plugin to work, you need to make sure that the
37
- database table has a lock_version column (or other column you name
38
- via the lock_column class level accessor) that defaults to 0.
39
-
40
- The optimistic_locking plugin does not work with the
41
- class_table_inheritance plugin.
42
-
43
- * Dataset#unused_table_alias was added, which takes a symbol and
44
- returns either that symbol or a new symbol which can be used as
45
- a table alias when joining a table to the dataset. The symbol
46
- returned is guaranteed to not already be used by the dataset:
47
-
48
- DB[:test].unused_table_alias(:blah) # => :blah
49
- DB[:test].unused_table_alias(:test) # => :test_0
50
-
51
- The use case is when you need to join a table to a dataset, where
52
- the table may already be used inside the dataset, and you want
53
- to generate a unique alias:
54
-
55
- ds.join(:table.as(ds.unused_table_alias(:table)), ...)
56
-
57
- * The Sequel::ValidationFailed exception now has an errors accessor
58
- which returns the Sequel::Model::Errors instance with the
59
- validation errors. This can be helpful in situations where a
60
- generalized rescue is done where the model object reference is
61
- not available.
62
-
63
- * bin/sequel now works without an argument, which is useful for
64
- testing SQL generation (and not much else).
65
-
66
- * Support SELECT ... INTO in the MSSQL adapter, using Dataset#into,
67
- which takes a table argument.
68
-
69
- * You can now provide your own connection pool class via the
70
- :pool_class option when instantiating the database.
71
-
72
- Other Improvements
73
- ------------------
74
-
75
- * IN/NOT IN constructs with an empty array are now handled properly.
76
-
77
- DB[:table].filter(:id=>[]) # IN
78
- DB[:table].exclude(:id=>[]) # NOT IN
79
-
80
- Before, the IN construct would mostly work, other than some minor
81
- differences in NULL semantics. However, the NOT IN construct
82
- would not work. Sequel now handles the NOT IN case using an
83
- expression that evaluates to true.
84
-
85
- * If using an IN/NOT IN construct with multiple columns and a dataset
86
- argument, where multiple column IN/NOT IN support is emulated, a
87
- separate query is done to get the records, which is then handled
88
- like an array of values. This means that the following type of
89
- query now works on all tested databases:
90
-
91
- DB[:table1].filter([:id1, :id2]=>DB[:table2].select(:id1, :id2))
92
-
93
- * Schemas and aliases are now handled correctly when eager graphing.
94
-
95
- * Implicitly qualified symbols are now handled correctly in update
96
- statements, useful if you are updating a joined dataset and need
97
- to reference a column that appears in multiple tables.
98
-
99
- * The active_model plugin has been brought up to date with
100
- activemodel 3.0 beta (though it doesn't work on edge).
101
- Additionally, the active_model plugin now requires active_model
102
- in order to use ActiveModel::Naming.
103
-
104
- * In the schema_dumper extension, always include the varchar limit,
105
- even if it is 255 columns (the default). This makes it so that
106
- PostgreSQL will use a varchar(255) column instead of a text column
107
- when restoring a schema dump of a varchar(255) column from another
108
- database.
109
-
110
- * You can now load adapters from outside the Sequel lib directory,
111
- now they just need to be in a sequel/adapters directory somewhere
112
- in the LOAD_PATH.
113
-
114
- * You can now load extensions from outside the Sequel lib directory
115
- using Sequel.extension. External extensions need to be in a
116
- sequel/extensions directory somewhere in the LOAD_PATH.
117
-
118
- * Using bound variables for limit and offset in prepared statements
119
- now works correctly.
120
-
121
- * Performance of prepared statements was improved in the native
122
- SQLite adapter.
123
-
124
- * The schema_dumper extension now passes the options hash from
125
- dump_*_migration to Database#tables.
126
-
127
- * In the single_table_inheritance plugin, qualify the sti_key column
128
- with the table name, so that subclass datasets can safely be joined
129
- to other tables having the same column name.
130
-
131
- * In the single_table_inheritance plugin, handle case where the
132
- sti_key value is nil or '' specially, so that those cases
133
- always return an instance of the main model class. This fixes
134
- issues if constantize(nil) returns Object instead of raising
135
- an exception.
136
-
137
- * No longer use Date#to_s for literalization, always use ISO8601
138
- format for dates.
139
-
140
- * A couple lambdas which were instance_evaled were changed to procs
141
- for ruby 1.9.2 compatibility.
142
-
143
- * MSSQL emulated offset support was simplified to only use one
144
- subquery, and made to work correctly on ruby 1.9.
145
-
146
- * Emulate multiple column IN/NOT IN on H2, since it doesn't handle
147
- all cases correctly.
148
-
149
- * ODBC timestamps are now handled correctly if the database_timezone
150
- is nil.
151
-
152
- * ArgumentErrors raised when running queries in the ODBC adapter are
153
- now raised as DatabaseErrors.
154
-
155
- * Attempting to use DISTINCT ON on SQLite now raises an error before
156
- sending the query to the database.
157
-
158
- * The options hash passed to the database connection method is no
159
- longer modified. However, there may be additional options
160
- present in Database#opts that weren't specified by the options
161
- hash passed to the database connection method.
162
-
163
- * Make Dataset#add_graph_aliases handle the case where the dataset
164
- has not yet been graphed.
165
-
166
- * You can now provide an SQL::Identifier as a 4th argument to
167
- Dataset#join_table, and unsupported arguments are caught and an
168
- exception is raised.
169
-
170
- * The gem specification has been moved out of the Rakefile, so
171
- that the gem can now be built without rake, and works well with
172
- gem build and bundler.
173
-
174
- * The Rakefile no longer assumes the current directory is in the
175
- $LOAD_PATH, so it should work correctly on ruby 1.9.2.
176
-
177
- * All internal uses of require are now thread safe.
178
-
179
- * Empty query parameter keys in connection strings are now ignored
180
- instead of raising an exception.
181
-
182
- * The specs were changed so that you can run them in parallel.
183
- Previously there was a race condition in the migration extension
184
- specs.
185
-
186
- Backwards Compatibility
187
- -----------------------
188
-
189
- * If you plan on using sharding at any point, you now must pass
190
- a :servers option when connecting to the database, even if it is
191
- an empty hash. You can no longer just call Database#add_servers
192
- later.
193
-
194
- * The connection_proc and disconnection_proc accessors were removed
195
- from the connection pools, so you can no longer modify the procs
196
- after the connection pool has been instantiated. You must now
197
- provide the connection_proc as the block argument when
198
- instantiating the pool, and the disconnection_proc via the
199
- :disconnection_proc option.
200
-
201
- * In the hash passed to Dataset#update, symbol keys with a double
202
- embedded underscore are now considerated as implicit qualifiers,
203
- instead of being used verbatim. If you have a column that includes
204
- a double underscore, you now need to wrap it in an SQL::Identifier
205
- or use a String instead.
206
-
207
- * The connection pools no longer convert non-StandardError based
208
- exceptions to RuntimeErrors. Previously, all of the common adapters
209
- turned this feature off, so there is no change for most users.
210
-
211
- * Sequel::ConnectionPool is now considered an abstract class and
212
- should not be instantiated directly. Use ConnectionPool.get_pool
213
- to return an instance of the appropriate subclass.
214
-
215
- * The Sequel::SingleThreadedPool constant is no longer defined.
216
-
217
- * The private Dataset#eager_unique_table_alias method was removed,
218
- use the new public Dataset#unused_table_alias method instead, which
219
- has a slightly different API.
220
-
221
- * The private Dataset#eager_graph_qualify_order method was removed,
222
- used Dataset#qualified_expression instead.
223
-
224
- * The private Sequel::Model class methods plugin_gem_location and
225
- plugin_gem_location_old have been removed.
226
-
227
- * Gems built with the rake tasks now show up in the root directory
228
- instead of the pkg subdirectory, and no tarball package is created.
229
-
230
- Other News
231
- ----------
232
-
233
- * Sequel now has an official blog at http://sequel.jeremyevans.net/blog.html.