sequel 3.21.0 → 3.28.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.
Files changed (158) hide show
  1. data/CHANGELOG +294 -0
  2. data/README.rdoc +20 -6
  3. data/Rakefile +20 -15
  4. data/doc/association_basics.rdoc +210 -43
  5. data/doc/dataset_basics.rdoc +4 -4
  6. data/doc/mass_assignment.rdoc +54 -0
  7. data/doc/migration.rdoc +15 -538
  8. data/doc/model_hooks.rdoc +64 -27
  9. data/doc/opening_databases.rdoc +37 -10
  10. data/doc/prepared_statements.rdoc +16 -10
  11. data/doc/reflection.rdoc +8 -2
  12. data/doc/release_notes/3.22.0.txt +39 -0
  13. data/doc/release_notes/3.23.0.txt +172 -0
  14. data/doc/release_notes/3.24.0.txt +420 -0
  15. data/doc/release_notes/3.25.0.txt +88 -0
  16. data/doc/release_notes/3.26.0.txt +88 -0
  17. data/doc/release_notes/3.27.0.txt +82 -0
  18. data/doc/release_notes/3.28.0.txt +304 -0
  19. data/doc/schema_modification.rdoc +547 -0
  20. data/doc/testing.rdoc +106 -0
  21. data/doc/transactions.rdoc +97 -0
  22. data/doc/virtual_rows.rdoc +2 -2
  23. data/lib/sequel/adapters/ado.rb +12 -1
  24. data/lib/sequel/adapters/amalgalite.rb +4 -0
  25. data/lib/sequel/adapters/db2.rb +95 -58
  26. data/lib/sequel/adapters/do.rb +12 -0
  27. data/lib/sequel/adapters/firebird.rb +25 -203
  28. data/lib/sequel/adapters/ibmdb.rb +440 -0
  29. data/lib/sequel/adapters/informix.rb +4 -19
  30. data/lib/sequel/adapters/jdbc/as400.rb +0 -7
  31. data/lib/sequel/adapters/jdbc/db2.rb +49 -0
  32. data/lib/sequel/adapters/jdbc/firebird.rb +34 -0
  33. data/lib/sequel/adapters/jdbc/h2.rb +16 -5
  34. data/lib/sequel/adapters/jdbc/informix.rb +31 -0
  35. data/lib/sequel/adapters/jdbc/jtds.rb +34 -0
  36. data/lib/sequel/adapters/jdbc/mssql.rb +0 -32
  37. data/lib/sequel/adapters/jdbc/mysql.rb +9 -0
  38. data/lib/sequel/adapters/jdbc/oracle.rb +2 -27
  39. data/lib/sequel/adapters/jdbc/postgresql.rb +6 -0
  40. data/lib/sequel/adapters/jdbc/sqlserver.rb +46 -0
  41. data/lib/sequel/adapters/jdbc/transactions.rb +34 -0
  42. data/lib/sequel/adapters/jdbc.rb +62 -29
  43. data/lib/sequel/adapters/mysql.rb +22 -139
  44. data/lib/sequel/adapters/mysql2.rb +9 -14
  45. data/lib/sequel/adapters/odbc/db2.rb +21 -0
  46. data/lib/sequel/adapters/odbc.rb +15 -3
  47. data/lib/sequel/adapters/oracle.rb +17 -1
  48. data/lib/sequel/adapters/postgres.rb +111 -16
  49. data/lib/sequel/adapters/shared/access.rb +21 -0
  50. data/lib/sequel/adapters/shared/db2.rb +290 -0
  51. data/lib/sequel/adapters/shared/firebird.rb +214 -0
  52. data/lib/sequel/adapters/shared/informix.rb +45 -0
  53. data/lib/sequel/adapters/shared/mssql.rb +85 -47
  54. data/lib/sequel/adapters/shared/mysql.rb +50 -7
  55. data/lib/sequel/adapters/shared/mysql_prepared_statements.rb +143 -0
  56. data/lib/sequel/adapters/shared/oracle.rb +0 -4
  57. data/lib/sequel/adapters/shared/postgres.rb +75 -43
  58. data/lib/sequel/adapters/shared/sqlite.rb +56 -8
  59. data/lib/sequel/adapters/sqlite.rb +12 -11
  60. data/lib/sequel/adapters/swift/mysql.rb +9 -0
  61. data/lib/sequel/adapters/tinytds.rb +139 -7
  62. data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +55 -0
  63. data/lib/sequel/ast_transformer.rb +190 -0
  64. data/lib/sequel/connection_pool/threaded.rb +3 -2
  65. data/lib/sequel/connection_pool.rb +1 -1
  66. data/lib/sequel/core.rb +6 -5
  67. data/lib/sequel/database/connecting.rb +5 -5
  68. data/lib/sequel/database/dataset.rb +1 -1
  69. data/lib/sequel/database/dataset_defaults.rb +1 -1
  70. data/lib/sequel/database/logging.rb +1 -1
  71. data/lib/sequel/database/misc.rb +38 -17
  72. data/lib/sequel/database/query.rb +50 -19
  73. data/lib/sequel/database/schema_generator.rb +8 -5
  74. data/lib/sequel/database/schema_methods.rb +52 -27
  75. data/lib/sequel/dataset/actions.rb +167 -48
  76. data/lib/sequel/dataset/features.rb +57 -8
  77. data/lib/sequel/dataset/graph.rb +1 -1
  78. data/lib/sequel/dataset/misc.rb +39 -20
  79. data/lib/sequel/dataset/mutation.rb +3 -3
  80. data/lib/sequel/dataset/prepared_statements.rb +29 -14
  81. data/lib/sequel/dataset/query.rb +182 -32
  82. data/lib/sequel/dataset/sql.rb +31 -58
  83. data/lib/sequel/dataset.rb +8 -0
  84. data/lib/sequel/exceptions.rb +4 -0
  85. data/lib/sequel/extensions/columns_introspection.rb +61 -0
  86. data/lib/sequel/extensions/migration.rb +6 -4
  87. data/lib/sequel/extensions/to_dot.rb +95 -83
  88. data/lib/sequel/model/associations.rb +893 -309
  89. data/lib/sequel/model/base.rb +302 -105
  90. data/lib/sequel/model/errors.rb +1 -1
  91. data/lib/sequel/model/exceptions.rb +5 -1
  92. data/lib/sequel/model.rb +13 -7
  93. data/lib/sequel/plugins/association_pks.rb +22 -4
  94. data/lib/sequel/plugins/defaults_setter.rb +58 -0
  95. data/lib/sequel/plugins/identity_map.rb +113 -6
  96. data/lib/sequel/plugins/many_through_many.rb +67 -5
  97. data/lib/sequel/plugins/prepared_statements.rb +140 -0
  98. data/lib/sequel/plugins/prepared_statements_associations.rb +84 -0
  99. data/lib/sequel/plugins/prepared_statements_safe.rb +82 -0
  100. data/lib/sequel/plugins/prepared_statements_with_pk.rb +59 -0
  101. data/lib/sequel/plugins/serialization_modification_detection.rb +51 -0
  102. data/lib/sequel/plugins/sharding.rb +12 -20
  103. data/lib/sequel/plugins/single_table_inheritance.rb +2 -0
  104. data/lib/sequel/plugins/update_primary_key.rb +1 -1
  105. data/lib/sequel/plugins/xml_serializer.rb +3 -3
  106. data/lib/sequel/sql.rb +107 -51
  107. data/lib/sequel/timezones.rb +12 -3
  108. data/lib/sequel/version.rb +1 -1
  109. data/spec/adapters/db2_spec.rb +146 -0
  110. data/spec/adapters/mssql_spec.rb +36 -0
  111. data/spec/adapters/mysql_spec.rb +36 -19
  112. data/spec/adapters/postgres_spec.rb +115 -28
  113. data/spec/adapters/spec_helper.rb +6 -0
  114. data/spec/adapters/sqlite_spec.rb +11 -0
  115. data/spec/core/connection_pool_spec.rb +62 -77
  116. data/spec/core/database_spec.rb +244 -287
  117. data/spec/core/dataset_spec.rb +383 -34
  118. data/spec/core/expression_filters_spec.rb +159 -41
  119. data/spec/core/schema_spec.rb +326 -3
  120. data/spec/core/spec_helper.rb +45 -0
  121. data/spec/extensions/association_pks_spec.rb +38 -0
  122. data/spec/extensions/columns_introspection_spec.rb +91 -0
  123. data/spec/extensions/defaults_setter_spec.rb +64 -0
  124. data/spec/extensions/identity_map_spec.rb +162 -0
  125. data/spec/extensions/many_through_many_spec.rb +195 -20
  126. data/spec/extensions/migration_spec.rb +17 -17
  127. data/spec/extensions/nested_attributes_spec.rb +1 -0
  128. data/spec/extensions/prepared_statements_associations_spec.rb +126 -0
  129. data/spec/extensions/prepared_statements_safe_spec.rb +79 -0
  130. data/spec/extensions/prepared_statements_spec.rb +72 -0
  131. data/spec/extensions/prepared_statements_with_pk_spec.rb +38 -0
  132. data/spec/extensions/schema_dumper_spec.rb +2 -2
  133. data/spec/extensions/schema_spec.rb +12 -20
  134. data/spec/extensions/serialization_modification_detection_spec.rb +36 -0
  135. data/spec/extensions/single_table_inheritance_spec.rb +11 -0
  136. data/spec/extensions/spec_helper.rb +3 -1
  137. data/spec/extensions/to_dot_spec.rb +3 -5
  138. data/spec/extensions/xml_serializer_spec.rb +16 -4
  139. data/spec/integration/associations_test.rb +405 -15
  140. data/spec/integration/database_test.rb +4 -2
  141. data/spec/integration/dataset_test.rb +240 -20
  142. data/spec/integration/plugin_test.rb +142 -5
  143. data/spec/integration/prepared_statement_test.rb +174 -95
  144. data/spec/integration/schema_test.rb +128 -16
  145. data/spec/integration/spec_helper.rb +15 -0
  146. data/spec/integration/transaction_test.rb +40 -0
  147. data/spec/integration/type_test.rb +16 -2
  148. data/spec/model/association_reflection_spec.rb +91 -0
  149. data/spec/model/associations_spec.rb +476 -5
  150. data/spec/model/base_spec.rb +91 -1
  151. data/spec/model/eager_loading_spec.rb +519 -31
  152. data/spec/model/hooks_spec.rb +161 -0
  153. data/spec/model/model_spec.rb +89 -2
  154. data/spec/model/plugins_spec.rb +17 -0
  155. data/spec/model/record_spec.rb +184 -12
  156. data/spec/model/spec_helper.rb +5 -0
  157. data/spec/model/validations_spec.rb +11 -0
  158. metadata +85 -34
data/CHANGELOG CHANGED
@@ -1,3 +1,297 @@
1
+ === 3.28.0 (2011-10-03)
2
+
3
+ * Add firebird jdbc subadapter (jeremyevans)
4
+
5
+ * Add SQLTime.create method for easier creation of SQLTime instances (jeremyevans)
6
+
7
+ * Make Dataset#with_pk use a qualified primary key, so it works correctly on joined datasets (jeremyevans)
8
+
9
+ * Support the :limit association option when using eager_graph (jeremyevans)
10
+
11
+ * Fix eager loading via eager_graph of one_to_one associations that match multiple associated objects and use order to pick the first one (jeremyevans)
12
+
13
+ * Make after_load association hooks apply when using eager_graph (jeremyevans)
14
+
15
+ * Make Dataset#with_sql treat a symbol as a first argument as a method name to call to get the SQL (jeremyevans)
16
+
17
+ * Make Dataset #delete, #insert, #update return array of plain hashes if block not given and Dataset#returning is used (jeremyevans)
18
+
19
+ * Allow Dataset #map, #to_hash, #select_map, #select_order_map, and #select_hash to take arrays of columns instead of single columns (jeremyevans)
20
+
21
+ * Make Dataset #delete, #insert, #update yield plain hashes to a block if Dataset#returning is used (jeremyevans)
22
+
23
+ * Add Dataset#returning for setting the columns to return in INSERT/UPDATE/DELETE statements, used by PostgreSQL 9.1 (jeremyevans)
24
+
25
+ * Support WITH clause in INSERT/UPDATE/DELETE on PostgreSQL 9.1+ (jeremyevans)
26
+
27
+ * Add Database#copy_table for PostgreSQL COPY support when using the postgres adapter with pg (jeremyevans)
28
+
29
+ * Support CREATE TABLE IF NOT EXISTS on PostgreSQL 9.1+ (jeremyevans)
30
+
31
+ * Add support for Sequel::Model.default_eager_limit_strategy to set the default :eager_limit_strategy for *_many associations (jeremyevans)
32
+
33
+ * Add support for an :eager_limit_strategy => :correlated_subquery value for limiting using correlated subqueries (jeremyevans)
34
+
35
+ * Allow use of a dataset that uses the emulated offset support on MSSQL and DB2 in an IN subquery by using a nested subquery (jeremyevans)
36
+
37
+ * Allow use of a dataset that uses LIMIT in an IN subquery on MySQL by using a nested subquery (jeremyevans)
38
+
39
+ * Work around serious ActiveSupport bug in Time.=== that breaks literalization of Time values (jeremyevans)
40
+
41
+ * Speed up SQL operator methods by using module_eval instead of define_method (jeremyevans)
42
+
43
+ * Support sql_(boolean,number,string) methods on ComplexExpressions, allowing you do to (x + 1).sql_string + 'a' for (x + 1) || 'a' (jeremyevans)
44
+
45
+ * Don't disallow SQL expression creation based on types, leave that to the database server (jeremyevans)
46
+
47
+ * Make :column [&|] 1 use an SQL bitwise [&|] expression instead of a logical (AND|OR) expression (jeremyevans)
48
+
49
+ * Make :column + 'a' use an SQL string concatenation expression instead of an addition expression (jeremyevans)
50
+
51
+ * Fix :time typecasting from Time to SQLTime for fractional seconds on ruby 1.9 (jeremyevans)
52
+
53
+ * Have Dataset#select_append check supports_select_all_and_column? and select all from all FROM and JOIN tables if no columns selected (jeremyevans)
54
+
55
+ * Add Dataset#supports_select_all_and_column? for checking if you can do SELECT *, column (jeremyevans)
56
+
57
+ * Add support for an :eager_limit_strategy => :window_function value for limiting using window functions (jeremyevans)
58
+
59
+ * Add support for an :eager_limit_strategy => :distinct_on value for one_to_one associations for using DISTINCT ON (jeremyevans)
60
+
61
+ * Add support for an :eager_limit_strategy association option, for manual control over how limiting is done (jeremyevans)
62
+
63
+ * Add Dataset#supports_ordered_distinct_on? for checking if the dataset can use distinct on while respecting order (jeremyevans)
64
+
65
+ * Add support for the association :limit option when eager loading via .eager for *_many associations (jeremyevans)
66
+
67
+ * Add db2 jdbc subadapter (jeremyevans)
68
+
69
+ * Fix the db2 adapter so it actually works (jeremyevans)
70
+
71
+ * Add ibmdb adapter for accessing DB2 (roylez, jeremyevans)
72
+
73
+ * Add much better support for DB2 databases (roylez, jeremyevans)
74
+
75
+ * Handle SQL::AliasedExpressions and SQL::JoinClauses in Dataset#select_all (jeremyevans)
76
+
77
+ * Speed up type translation slightly in mysql, postgres, and sqlite adapters (jeremyevans)
78
+
79
+ * Add Dataset#supports_cte_in_subqueries? for checking whether database supports WITH in subqueries (jeremyevans)
80
+
81
+ * Allow Model.set_dataset to accept Sequel::LiteralString arguments as table names (jeremyevans)
82
+
83
+ * Association :after_load hooks in lazy loading are now called after the associated objects have been cached (jeremyevans)
84
+
85
+ * Emulate handling of extract on MSSQL, using datepart (jeremyevans)
86
+
87
+ * Emulate handling of extract on SQLite, but you need to set Database#use_timestamp_timezones = false (jeremyevans)
88
+
89
+ * Abstract handling of ComplexExpressionMethods#extract so that it can work on databases that don't implement extract (jeremyevans)
90
+
91
+ * Emulate xor operator on SQLite (jeremyevans)
92
+
93
+ * Add Dataset#supports_where_true? for checking if the database supports WHERE true (or WHERE 1 if 1 is true) (jeremyevans)
94
+
95
+ * Fix eager loading via eager of one_to_one associations that match multiple associated objects and use order to pick the first one (jeremyevans)
96
+
97
+ === 3.27.0 (2011-09-01)
98
+
99
+ * Add support for native prepared statements to the tinytds adapter (jeremyevans)
100
+
101
+ * Add support for native prepared statements and stored procedures to the mysql2 adapter (jeremyevans)
102
+
103
+ * Support dropping primary key, foreign key, and unique constraints on MySQL via the drop_constraint :type option (jeremyevans)
104
+
105
+ * Add Sequel::SQLTime class for handling SQL time columns (jeremyevans)
106
+
107
+ * Typecast DateTime objects to Date for date columns (jeremyevans)
108
+
109
+ * When typecasting Date objects to timestamps, make the resulting objects always have no fractional date components (jeremyevans)
110
+
111
+ * Add Model.dataset_module for simplifying many def_dataset_method calls (jeremyevans)
112
+
113
+ * Make prepared_statements_safe plugin work on classes without datasets (jeremyevans)
114
+
115
+ * Make Dataset#hash work correctly when referencing SQL::Expression instances (jeremyevans)
116
+
117
+ * Handle allowed mass assignment methods correctly when including modules in classes or extending instances with modules (jeremyevans)
118
+
119
+ * Fix Model#hash to work correctly with composite primary keys and with no primary key (jeremyevans)
120
+
121
+ * Model#exists? now returns false without issuing a query for new model objects (jeremyevans)
122
+
123
+ === 3.26.0 (2011-08-01)
124
+
125
+ * Fix bug in default connection pool if a disconnect error is raised and the disconnection_proc also raises an error (jeremyevans)
126
+
127
+ * Disallow eager loading via eager of many_*_many associations with :eager_graph option (jeremyevans)
128
+
129
+ * Major speedup in dataset creation (jeremyevans)
130
+
131
+ * Replace internal implementation of eager_graph with much faster version (jeremyevans)
132
+
133
+ * Don't treat strings with leading zeros as octal format in the default typecasting (jeremyevans)
134
+
135
+ * Fix literalization of Date, Time, and DateTime values on Microsoft Access (jeremyevans)
136
+
137
+ * Fix handling of nil values with the pure-Java version of nokogiri in the xml_serializer plugin (jeremyevans)
138
+
139
+ * Make identity_map plugin work with standard eager loading of many_to_many and many_through_many associations (jeremyevans)
140
+
141
+ * Make create_table! only attempt to drop the table if it already exists (jeremyevans)
142
+
143
+ * Remove custom table_exists? implementations in the oracle and postgres adapters (jeremyevans)
144
+
145
+ * Handle another type of disconnection in the postgres adapter (jeremyevans)
146
+
147
+ * Handle disconnections in the ado adapter and do postgres subadapter (jeremyevans)
148
+
149
+ * Recognize disconnections when issuing BEGIN/ROLLBACK/COMMIT statements (jeremyevans) (#368)
150
+
151
+ === 3.25.0 (2011-07-01)
152
+
153
+ * Work with tiny_tds-0.4.5 in the tinytds adapter, older versions are no longer supported (jeremyevans)
154
+
155
+ * Make association_pks plugin typecast provided values to integer if the primary key column type is integer (jeremyevans)
156
+
157
+ * Model.set_dataset now accepts Identifier, QualifiedIdentifier, and AliasedExpression arguments (jeremyevans)
158
+
159
+ * Fix handling of nil values in bound variables and prepared statement and stored procedure arguments in the jdbc adapter (jeremyevans, wei)
160
+
161
+ * Allow treating Datasets as Expressions, e.g. DB[:table1].select(:column1) > DB[:table2].select(:column2) (jeremyevans)
162
+
163
+ * No longer use CASCADE by default when dropping tables on PostgreSQL (jeremyevans)
164
+
165
+ * Support :cascade option to #drop_table, #drop_view, #drop_column, and #drop_constraint for using CASCADE (jeremyevans)
166
+
167
+ * If validation error messages are LiteralStrings, don't add the column name to them in Errors#full_messages (jeremyevans)
168
+
169
+ * Fix bug loading plugins on 1.9 where ::ClassMethods, ::InstanceMethods, or ::DatasetMethods is defined (jeremyevans)
170
+
171
+ * Add Dataset#exclude_where and Dataset#exclude_having methods, so you can force use of having or where clause (jeremyevans)
172
+
173
+ * Allow Dataset#select_all to take table name arguments and select all columns from each given table (jeremyevans)
174
+
175
+ * Add Dataset#select_group method, for selecting and grouping on the same columns (jeremyevans)
176
+
177
+ * Allow Dataset#group and Dataset#group_and_count to accept a virtual row block (jeremyevans)
178
+
179
+ === 3.24.1 (2011-06-03)
180
+
181
+ * Ignore index creation errors if using create_table? with the IF NOT EXISTS syntax (jeremyevans) (#362)
182
+
183
+ === 3.24.0 (2011-06-01)
184
+
185
+ * Add prepared_statements_association plugin, for using prepared statements by default for regular association loading (jeremyevans)
186
+
187
+ * Add prepared_statements_safe plugin, for making prepared statement use with models more safe (jeremyevans)
188
+
189
+ * Add prepared_statements_with_pk plugin, for using prepared statements for dataset lookups by primary key (jeremyevans)
190
+
191
+ * Fix bug in emulated prepared statement support not supporting nil or false as bound values (jeremyevans)
192
+
193
+ * Add Dataset#unbind for unbinding values from a dataset, for use with creating prepared statements (jeremyevans)
194
+
195
+ * Add prepared_statements plugin for using prepared statements for updates, inserts, deletes, and lookups by primary key (jeremyevans)
196
+
197
+ * Make Dataset#[] for model datasets consider a single integer argument as a lookup by primary key (jeremyevans)
198
+
199
+ * Add Dataset#with_pk for model datasets, for finding first record with matching primary key value (jeremyevans)
200
+
201
+ * Add defaults_setter plugin for setting default values when initializing model instances (jeremyevans)
202
+
203
+ * Add around hooks (e.g. around_save) to Sequel::Model (jeremyevans)
204
+
205
+ * Add Model#initialize_set private method to ease extension writing (jeremyevans)
206
+
207
+ * Only typecast bit fields to booleans on MSSQL, the MySQL bit type is a bitfield, not a boolean (jeremyevans)
208
+
209
+ * Set SQL_AUTO_IS_NULL=0 by default when connecting to MySQL via the swift and jdbc adapters (jeremyevans)
210
+
211
+ * Fix bug in multiple column IN/NOT IN emulation when a model dataset is used (jeremyevans)
212
+
213
+ * Add support for filtering and excluding by association datasets (jeremyevans)
214
+
215
+ * Fix literalization of boolean values in filters on SQLite and MSSQL (jeremyevans)
216
+
217
+ * Add support for filtering and excluding by multiple associations (jeremyevans)
218
+
219
+ * Add support for inverting some SQL::Constant instances such as TRUE, FALSE, NULL, and NOTNULL (jeremyevans)
220
+
221
+ * Add support for excluding by associations to model datasets (jeremyevans)
222
+
223
+ * The Sequel::Postgres.use_iso_date_format setting now only affects future Database objects (jeremyevans)
224
+
225
+ * Add Sequel::Postgres::PG_NAMED_TYPES hash for extensions to register type conversions for non-standard types (jeremyevans, pvh)
226
+
227
+ * Make create_table? use IF NOT EXISTS instead of using SELECT to determine existence, if supported (jeremyevans)
228
+
229
+ * Fix bug in association_pks plugin when associated table has a different primary key column name (jfirebaugh)
230
+
231
+ * Fix limiting rows when connecting to DB2 (semmons99)
232
+
233
+ * Exclude columns from tables in the INFORMATION_SCHEMA when parsing table schema on JDBC (jeremyevans)
234
+
235
+ * Fix limiting rows when connecting to Microsoft Access (jeremyevans)
236
+
237
+ * Add Database#views for getting an array of symbols of view names for the database (jeremyevans, christian.michon)
238
+
239
+ * Make Datbase#tables no longer include view names on MySQL (jeremyevans)
240
+
241
+ * Convert Java CLOB objects to ruby strings when using the JDBC JTDS subadapter (christian.michon)
242
+
243
+ * If Thread#kill is called on a thread with an open transaction, roll the transaction back on ruby 1.8 and rubinius (jeremyevans)
244
+
245
+ * Split informix adapter into shared/specific parts, add JDBC informix subadapter (jeremyevans)
246
+
247
+ === 3.23.0 (2011-05-02)
248
+
249
+ * Migrate issue tracker from Google Code to GitHub Issues (jeremyevans)
250
+
251
+ * Add support for filtering by associations to model datasets (jeremyevans)
252
+
253
+ * Don't call insert_select when saving a model that doesn't select all columns of the table (jeremyevans)
254
+
255
+ * Fix bug when using :select=>[] option for a many_to_many association (jeremyevans)
256
+
257
+ * Add a columns_introspection extension that attempts to skip database queries by introspecting selected columns (jeremyevans)
258
+
259
+ * When combining old integer migrations and new timestamp migrations, make sure old integer migrations are all applied first (jeremyevans)
260
+
261
+ * Support dynamic callbacks to customize regular association loading at query time (jeremyevans)
262
+
263
+ * Support cascading of eager loading with dynamic callbacks for both eager and eager_graph (jeremyevans)
264
+
265
+ * Make the xml_serializer plugin handle namespaced models by using __ instead of / as a separator (jeremyevans)
266
+
267
+ * Allow the :eager_grapher association proc to accept a single hash instead of 3 arguments (jfirebaugh)
268
+
269
+ * Support dynamic callbacks to customize eager loading at query time (jfirebaugh, jeremyevans)
270
+
271
+ * Fix bug in the identity_map plugin for many_to_one associations when the association reflection hadn't been filled in yet (funny-falcon)
272
+
273
+ * Add serialization_modification_detection plugin for detecting changes in serialized columns (jeremyevans) (#333)
274
+
275
+ === 3.22.0 (2011-04-01)
276
+
277
+ * Add disconnect detection to tinytds adapter, though correct behavior may require an update to tiny_tds (cult_hero)
278
+
279
+ * Add Dataset/Database#mssql_unicode_strings accessor when connecting to MSSQL to control string literalization (semmons99, jeremyevans)
280
+
281
+ * Fix ODBC::Time instance handling in the odbc adapter (jeremyevans)
282
+
283
+ * Use Sequel.application_timezone when connecting in the oracle adapter to set the connection's session's timezone (jmthomas)
284
+
285
+ * In the ADO adapter, assume access to SQL Server if a :conn_string option is given that doesn't indicate Access/Jet (damir.si) (#332)
286
+
287
+ * Use the correct class when loading instances for descendents of model classes that use single table inheritance (jeremyevans)
288
+
289
+ * Support for COLLATE in column definitions (jfirebaugh)
290
+
291
+ * Don't use a schema when creating a temporary table (jeremyevans)
292
+
293
+ * Make migrator work correctly when a default_schema is set (jeremyevans) (#331)
294
+
1
295
  === 3.21.0 (2011-03-01)
2
296
 
3
297
  * Make symbol splitting (:table__column___alias) work correctly for identifiers that are not in the \w character class (authorNari)
data/README.rdoc CHANGED
@@ -12,15 +12,15 @@ toolkit for Ruby.
12
12
  two-phase commit, transaction isolation, master/slave
13
13
  configurations, and database sharding.
14
14
  * Sequel currently has adapters for ADO, Amalgalite, DataObjects,
15
- DB2, DBI, Firebird, Informix, JDBC, MySQL, Mysql2, ODBC, OpenBase,
16
- Oracle, PostgreSQL, SQLite3, Swift, and TinyTDS.
15
+ DB2, DBI, Firebird, IBM_DB, Informix, JDBC, MySQL, Mysql2, ODBC,
16
+ OpenBase, Oracle, PostgreSQL, SQLite3, Swift, and TinyTDS.
17
17
 
18
18
  == Resources
19
19
 
20
20
  * {Website}[http://sequel.rubyforge.org]
21
21
  * {Blog}[http://sequel.heroku.com]
22
22
  * {Source code}[http://github.com/jeremyevans/sequel]
23
- * {Bug tracking}[http://code.google.com/p/ruby-sequel/issues/list]
23
+ * {Bug tracking}[http://github.com/jeremyevans/sequel/issues]
24
24
  * {Google group}[http://groups.google.com/group/sequel-talk]
25
25
  * {RDoc}[http://sequel.rubyforge.org/rdoc]
26
26
 
@@ -573,7 +573,7 @@ You can execute custom code when creating, updating, or deleting records by defi
573
573
 
574
574
  Note the use of +super+ if you define your own hook methods. Almost all <tt>Sequel::Model</tt> class and instance methods (not just hook methods) can be overridden safely, but you have to make sure to call +super+ when doing so, otherwise you risk breaking things.
575
575
 
576
- For the example above, you should probably use a database trigger if you can. Hooks can be used for data integrity, but they will only enforce that integrity when you are modifying the database through model instances. If you plan on allowing any other access to the database, it's best to use database triggers for data integrity.
576
+ For the example above, you should probably use a database trigger if you can. Hooks can be used for data integrity, but they will only enforce that integrity when you are modifying the database through model instances. If you plan on allowing any other access to the database, it's best to use database triggers and constraints for data integrity.
577
577
 
578
578
  === Deleting records
579
579
 
@@ -681,9 +681,23 @@ Associations can be eagerly loaded via +eager+ and the <tt>:eager</tt> associati
681
681
  # Loads all people, their posts, their posts' tags, replies to those posts,
682
682
  # the person for each reply, the tag for each reply, and all posts and
683
683
  # replies that have that tag. Uses a total of 8 queries.
684
- Person.eager(:posts=>{:replies=>[:person, {:tags=>{:posts, :replies}}]}).all
684
+ Person.eager(:posts=>{:replies=>[:person, {:tags=>[:posts, :replies]}]}).all
685
685
 
686
- In addition to using +eager+, you can also use +eager_graph+, which will use a single query to get the object and all associated objects. This may be necessary if you want to filter or order the result set based on columns in associated tables. It works with cascading as well, the syntax is exactly the same. Note that using eager_graph to eagerly load multiple *_to_many associations will cause the result set to be a cartesian product, so you should be very careful with your filters when using it in that case.
686
+ In addition to using +eager+, you can also use +eager_graph+, which will use a single query to get the object and all associated objects. This may be necessary if you want to filter or order the result set based on columns in associated tables. It works with cascading as well, the API is very similar. Note that using +eager_graph+ to eagerly load multiple <tt>*_to_many</tt> associations will cause the result set to be a cartesian product, so you should be very careful with your filters when using it in that case.
687
+
688
+ You can dynamically customize the eagerly loaded dataset by using using a proc. This proc is passed the dataset used for eager loading, and should return a modified copy of that dataset:
689
+
690
+ # Eagerly load only replies containing 'foo'
691
+ Post.eager(:replies=>proc{|ds| ds.filter(text.like('%foo%'))}).all
692
+
693
+ This also works when using +eager_graph+, in which case the proc is called with dataset to graph into the current dataset:
694
+
695
+ Post.eager_graph(:replies=>proc{|ds| ds.filter(text.like('%foo%'))}).all
696
+
697
+ You can dynamically customize eager loads for both +eager+ and +eager_graph+ while also cascading, by making the value a single entry hash with the proc as a key, and the cascaded associations as the value:
698
+
699
+ # Eagerly load only replies containing 'foo', and the person and tags for those replies
700
+ Post.eager(:replies=>{proc{|ds| ds.filter(text.like('%foo%'))}=>[:person, :tags]}).all
687
701
 
688
702
  === Extending the underlying dataset
689
703
 
data/Rakefile CHANGED
@@ -1,11 +1,5 @@
1
1
  require "rake"
2
2
  require "rake/clean"
3
- require "rake/gempackagetask"
4
- begin
5
- require "hanna/rdoctask"
6
- rescue LoadError
7
- require "rake/rdoctask"
8
- end
9
3
 
10
4
  NAME = 'sequel'
11
5
  VERS = lambda do
@@ -13,8 +7,6 @@ VERS = lambda do
13
7
  Sequel.version
14
8
  end
15
9
  CLEAN.include ["**/.*.sw?", "sequel-*.gem", ".config", "rdoc", "coverage", "www/public/*.html", "www/public/rdoc*", '**/*.rbc']
16
- RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'Sequel: The Database Toolkit for Ruby']
17
- RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
18
10
 
19
11
  # Gem Packaging and Release
20
12
 
@@ -40,7 +32,20 @@ end
40
32
 
41
33
  ### RDoc
42
34
 
43
- Rake::RDocTask.new do |rdoc|
35
+ RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'Sequel: The Database Toolkit for Ruby']
36
+
37
+ rdoc_task_class = begin
38
+ require "rdoc/task"
39
+ RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
40
+ RDoc::Task
41
+ rescue LoadError
42
+ require "rake/rdoctask"
43
+ Rake::RDocTask
44
+ end
45
+
46
+ RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
47
+
48
+ rdoc_task_class.new do |rdoc|
44
49
  rdoc.rdoc_dir = "rdoc"
45
50
  rdoc.options += RDOC_OPTS
46
51
  rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb doc/*.rdoc doc/release_notes/*.txt"
@@ -50,25 +55,25 @@ end
50
55
 
51
56
  desc "Make local version of website"
52
57
  task :website do
53
- sh %{www/make_www.rb}
58
+ sh %{#{RUBY} www/make_www.rb}
54
59
  end
55
60
 
56
61
  desc "Make rdoc for website"
57
62
  task :website_rdoc=>[:website_rdoc_main, :website_rdoc_adapters, :website_rdoc_plugins]
58
63
 
59
- Rake::RDocTask.new(:website_rdoc_main) do |rdoc|
64
+ rdoc_task_class.new(:website_rdoc_main) do |rdoc|
60
65
  rdoc.rdoc_dir = "www/public/rdoc"
61
66
  rdoc.options += RDOC_OPTS
62
67
  rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/*.rb lib/sequel/*.rb lib/sequel/{connection_pool,dataset,database,model}/*.rb doc/*.rdoc doc/release_notes/*.txt lib/sequel/extensions/migration.rb"
63
68
  end
64
69
 
65
- Rake::RDocTask.new(:website_rdoc_adapters) do |rdoc|
70
+ rdoc_task_class.new(:website_rdoc_adapters) do |rdoc|
66
71
  rdoc.rdoc_dir = "www/public/rdoc-adapters"
67
72
  rdoc.options += RDOC_DEFAULT_OPTS + %w'--main Sequel'
68
73
  rdoc.rdoc_files.add %w"lib/sequel/adapters/**/*.rb"
69
74
  end
70
75
 
71
- Rake::RDocTask.new(:website_rdoc_plugins) do |rdoc|
76
+ rdoc_task_class.new(:website_rdoc_plugins) do |rdoc|
72
77
  rdoc.rdoc_dir = "www/public/rdoc-plugins"
73
78
  rdoc.options += RDOC_DEFAULT_OPTS + %w'--main Sequel'
74
79
  rdoc.rdoc_files.add %w"lib/sequel/{extensions,plugins}/**/*.rb"
@@ -123,7 +128,7 @@ begin
123
128
  spec_with_cov.call("spec_plugin", Dir["spec/extensions/*_spec.rb"], "Run extension/plugin specs")
124
129
  spec_with_cov.call("spec_integration", Dir["spec/integration/*_test.rb"], "Run integration tests")
125
130
 
126
- %w'postgres sqlite mysql informix oracle firebird mssql'.each do |adapter|
131
+ %w'postgres sqlite mysql informix oracle firebird mssql db2'.each do |adapter|
127
132
  spec_with_cov.call("spec_#{adapter}", ["spec/adapters/#{adapter}_spec.rb"] + Dir["spec/integration/*_test.rb"], "Run #{adapter} specs")
128
133
  end
129
134
  rescue LoadError
@@ -154,5 +159,5 @@ end
154
159
 
155
160
  desc "Check syntax of all .rb files"
156
161
  task :check_syntax do
157
- Dir['**/*.rb'].each{|file| print `#{ENV['RUBY'] || :ruby} -c #{file} | fgrep -v "Syntax OK"`}
162
+ Dir['**/*.rb'].each{|file| print `#{RUBY} -c #{file} | fgrep -v "Syntax OK"`}
158
163
  end