activerecord-sqlserver-adapter 2.3.7 → 3.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +385 -61
  3. data/MIT-LICENSE +1 -1
  4. data/VERSION +1 -0
  5. data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +42 -0
  6. data/lib/active_record/connection_adapters/sqlserver/core_ext/database_statements.rb +97 -0
  7. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +41 -0
  8. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain_subscriber.rb +26 -0
  9. data/lib/active_record/connection_adapters/sqlserver/core_ext/odbc.rb +38 -0
  10. data/lib/active_record/connection_adapters/sqlserver/core_ext/relation.rb +19 -0
  11. data/lib/active_record/connection_adapters/sqlserver/database_limits.rb +49 -0
  12. data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +458 -0
  13. data/lib/active_record/connection_adapters/sqlserver/errors.rb +36 -0
  14. data/lib/active_record/connection_adapters/sqlserver/quoting.rb +113 -0
  15. data/lib/active_record/connection_adapters/sqlserver/schema_cache.rb +85 -0
  16. data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +376 -0
  17. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +69 -0
  18. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +25 -0
  19. data/lib/active_record/connection_adapters/sqlserver/showplan.rb +67 -0
  20. data/lib/active_record/connection_adapters/sqlserver/utils.rb +32 -0
  21. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +344 -1055
  22. data/lib/arel/visitors/sqlserver.rb +389 -0
  23. metadata +60 -83
  24. data/README.rdoc +0 -190
  25. data/RUNNING_UNIT_TESTS +0 -65
  26. data/Rakefile +0 -41
  27. data/autotest/discover.rb +0 -4
  28. data/autotest/railssqlserver.rb +0 -16
  29. data/autotest/sqlserver.rb +0 -54
  30. data/lib/active_record/connection_adapters/sqlserver_adapter/core_ext/active_record.rb +0 -151
  31. data/lib/active_record/connection_adapters/sqlserver_adapter/core_ext/odbc.rb +0 -40
  32. data/test/cases/aaaa_create_tables_test_sqlserver.rb +0 -19
  33. data/test/cases/adapter_test_sqlserver.rb +0 -756
  34. data/test/cases/attribute_methods_test_sqlserver.rb +0 -33
  35. data/test/cases/basics_test_sqlserver.rb +0 -21
  36. data/test/cases/calculations_test_sqlserver.rb +0 -20
  37. data/test/cases/column_test_sqlserver.rb +0 -285
  38. data/test/cases/connection_test_sqlserver.rb +0 -146
  39. data/test/cases/eager_association_test_sqlserver.rb +0 -42
  40. data/test/cases/execute_procedure_test_sqlserver.rb +0 -44
  41. data/test/cases/inheritance_test_sqlserver.rb +0 -28
  42. data/test/cases/method_scoping_test_sqlserver.rb +0 -28
  43. data/test/cases/migration_test_sqlserver.rb +0 -123
  44. data/test/cases/named_scope_test_sqlserver.rb +0 -21
  45. data/test/cases/offset_and_limit_test_sqlserver.rb +0 -108
  46. data/test/cases/pessimistic_locking_test_sqlserver.rb +0 -125
  47. data/test/cases/query_cache_test_sqlserver.rb +0 -24
  48. data/test/cases/schema_dumper_test_sqlserver.rb +0 -72
  49. data/test/cases/specific_schema_test_sqlserver.rb +0 -97
  50. data/test/cases/sqlserver_helper.rb +0 -127
  51. data/test/cases/table_name_test_sqlserver.rb +0 -38
  52. data/test/cases/transaction_test_sqlserver.rb +0 -93
  53. data/test/cases/unicode_test_sqlserver.rb +0 -50
  54. data/test/cases/validations_test_sqlserver.rb +0 -35
  55. data/test/connections/native_sqlserver/connection.rb +0 -25
  56. data/test/connections/native_sqlserver_odbc/connection.rb +0 -27
  57. data/test/migrations/transaction_table/1_table_will_never_be_created.rb +0 -11
  58. data/test/schema/sqlserver_specific_schema.rb +0 -94
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 518484bb28fd5a4a70ac12e7d994071c645ff0ea
4
+ data.tar.gz: 1eac15ea4105d11cc1f80e4e1416e173808ae9e3
5
+ SHA512:
6
+ metadata.gz: 1f570f10c5ec18d26353568f985bbc06b9d621f6afecc0c71e8f7ad2ee2eca80754d7c7c06cd413e7813394960abaf69d3c9832772095bba5ac5bb4638ae774a
7
+ data.tar.gz: e4f8c5d50c6fb2ce27460af6ea53592438964c5c93105ee5c66ce88c7a44e050e9c4faa5a7eec13197365dc531e5be25a4e08ec0b5f696934aec88348f7bd0cd
data/CHANGELOG CHANGED
@@ -1,5 +1,329 @@
1
+ * 3.2.18 *
1
2
 
2
- MASTER
3
+ * Added 2017 to supported list. Fixes #601. Thanks @catks.
4
+
5
+ * 3.2.17 *
6
+
7
+ * Add `WITH NO_INFOMSGS` to `user_options` method. Fixes #580
8
+
9
+
10
+ * 3.2.16 *
11
+
12
+ * All user optons to be array/hash. Fixes #540
13
+
14
+
15
+ * 3.2.15 *
16
+
17
+ * Added vNext support.
18
+
19
+
20
+ * 3.2.14 *
21
+
22
+ * Added 2016 to supported list.
23
+
24
+
25
+ * 3.2.13 *
26
+
27
+ * Allow 2014 to be used.
28
+
29
+
30
+ * 3.2.12 *
31
+
32
+ * Revert string_to_binary changes in 457af60e. Fixes #273.
33
+
34
+
35
+ * 3.2.11 *
36
+
37
+ * Handle "No such column" when renaming some columns in the migrations. Fixes #237. Thanks @michelgrootjans.
38
+ * Update regex for `RecordNotUnique` exception. Fixes #257. Thanks @pbatorre.
39
+ * Pass tds_version to TinyTDS. Fixes #233. Thanks @denispeplin.
40
+ * Use CONCAT_NULL_YIELDS_NULL for all TinyTDS connections. Fixes #262. Thanks @noel.
41
+ * Fix for Azure SQL. Fixed #263. Thanks @eklipse2k8.
42
+ * Drop shoulda and use minitest-spec-rails!!!
43
+ * Test TinyTDS 0.6.0.
44
+ * Fixed the unit tests due to changes in ActiveRecord that removes blank config values.
45
+ * Fixed explain tests that were failing due to changes in ExplainSubscriber, cause was regex
46
+ * Fixed change_column to update existing table column rows with new default value if there are any NULL values
47
+ and the column does not accept nulls
48
+ * Fixed change_column to drop and add indexes if the colun type is changes
49
+ * Fixed string_to_binary and binary_to_string in some cases where the binary data is not UTF-8
50
+ * Fixing generating profile report to create output dir if needed, and code change for printing report
51
+ * Adding ruby-prof to Gemfile, needed when running profile test cases
52
+ * Updating mocha to work with newer ActiveRecord test cases
53
+
54
+
55
+ * 3.2.10 *
56
+
57
+ * Remove connection defaults for host/username/password. Since we want to suppoert Windows Authentication
58
+ and there are just to many possibilities. So we now have to be explicit.
59
+ * Remove really old TinyTDS warning.
60
+
61
+
62
+ * 3.2.9 *
63
+
64
+ * The #remove_default_constraint uses #execute_procedure now. Fixes #223. Thanks @gicappa and @clintmiller.
65
+ * Mimic other adapters quoting for empty strings passed to integer columns. Fixes #164.
66
+ * Allow named parameters in stored procedures. Fixes #216. Thanks @sixfeetover.
67
+ * Make sure exclude [__rnt] table names form relation reflection. Fixes #219 and #221. Thanks @sphogan.
68
+
69
+
70
+ * 3.2.8 *
71
+
72
+ * Include VERSION in gemspec's files.
73
+
74
+
75
+ * 3.2.7 *
76
+
77
+ * Find VERSION in base file out of module namespace. Fixes #208
78
+ * Better support for explain without sp_execute args. FIxes #207
79
+
80
+
81
+ * 3.2.6 *
82
+
83
+ * Unique has_many associations with pagination now work. Fixes #209
84
+
85
+
86
+ * 3.2.5 *
87
+
88
+ * Fix a few test from ActiveRecord 3.2.6 upgrade.
89
+
90
+ * Fix db_name usage bug in #column_definitions [Altonymous]
91
+
92
+
93
+ * 3.2.4 *
94
+
95
+ * Fixed schema reflection for identity columns using ODBC. Fixes #193.
96
+
97
+
98
+ * 3.2.3 *
99
+
100
+ * Fixed datetime quoting for ActiveSupport::TimeWithZone objects. Fixes #187 and #189.
101
+
102
+
103
+ * 3.2.2 *
104
+
105
+ * Fixes all known issues with cross database schema reflection. Fixes #185 [Chris Altman]
106
+
107
+ * Fix exists? with offset by patching visitor. Fixes #171 and Fixes #167
108
+
109
+ * Set default text size to 2147483647 for TinyTDS connections. Fixes #181
110
+
111
+ * Set @config ivar for 3rd party libs. Fixes #177
112
+
113
+ * Make #sql_type_for_statement work for integers that may have empty parens or none at all. Fixes #175
114
+
115
+
116
+ * 3.2.1 *
117
+
118
+ * Add explicit order-by clause for windowed results. Fixes #161.
119
+
120
+
121
+ * 3.2.0 *
122
+
123
+ * ActiveRecord explain (SHOWPLAN) support.
124
+ http://youtu.be/ckb3YYZZZ2Q
125
+
126
+ * Remove our log_info_schema_queries config since we are not hooking properly into AR's 'SCHEMA' names.
127
+
128
+ * Properly use 'SCHEMA' name arguement in DB statements to comply with ActiveRecord::ExplainSubscriber::IGNORED_PAYLOADS.
129
+
130
+ * Make use of the new ConnectionAdapters::SchemaCache for our needs.
131
+
132
+ * New Sqlserver::Utils class for out helpers. Moved table name unquotes there.
133
+
134
+
135
+ * 3.1.5 *
136
+
137
+ * Better support for orders with an expression. Fixes #155. [Jason Frey, Joe Rafaniello]
138
+
139
+
140
+ * 3.1.4 *
141
+
142
+ * Use INFORMATION_SCHEMA.KEY_COLUMN_USAGE for schema reflection speed.
143
+ Fixes #125. [Wüthrich Hannes @hwuethrich]
144
+
145
+ * New deadlock victim retry using the #retry_deadlock_victim config. [Jason Frey, Joe Rafaniello]
146
+
147
+ * Renamed #with_auto_reconnect to #with_sqlserver_error_handling now that it handles both dropped
148
+ connections and deadlock victim errors. Fixes #150 [Jason Frey, Joe Rafaniello]
149
+
150
+ * Add activity_stats method that mimics the SQL Server Activity Monitor. Fixes #146 [Jason Frey, Joe Rafaniello]
151
+
152
+ * Add methods for sqlserver's #product_version, #product_level, #edition and include them in inspect.
153
+ Fixes #145 [Jason Frey, Joe Rafaniello]
154
+
155
+ * Handle statements that cannot be retried on a new database connection by not reconnecting.
156
+ Fixes #147 [Jason Frey, Joe Rafaniello]
157
+
158
+ * Added connection#spid for debugging. Fixes #144 [Jason Frey, Joe Rafaniello]
159
+
160
+ * Add ENV['TEST_FILES'] to Rakefile for easy single case tests. [Jason Frey, Joe Rafaniello]
161
+
162
+ * Pass ActiveRecord tests. Made windowed distinct pass all orders to groups.
163
+ - test_limited_eager_with_multiple_order_columns
164
+ - test_limited_eager_with_order
165
+
166
+ * Pass AR tests by moving DISTINCT to GROUP BY in windowed SQL.
167
+ - test_count_eager_with_has_many_and_limit_and_high_offset
168
+ - test_eager_with_has_many_and_limit_and_high_offset
169
+
170
+
171
+ * 3.1.3 *
172
+
173
+ * Distinguish between identity and primary key key columns during schema reflection. Allows us
174
+ us to only do identity inserts when technically needed. Fixes #139 [chadcf] & [joncanady]
175
+
176
+
177
+ * 3.1.2 *
178
+
179
+ * Fix SQL Azure conflicts with DBCC useroptions. Use new #user_options_xyz methods. [kazamachi]
180
+
181
+ * Fix identity inserts for tables with natural PKs. [Gian Carlo Pace]
182
+
183
+ * Create a #configure_connection method that can be overridden. Think "SET TEXTSIZE...".
184
+
185
+ * Create a #configure_application_name method that can be overridden for unique TinyTDS app names
186
+
187
+ * Fixed the #finish_statement_handle to cancel the TinyTDS connection if needed.
188
+
189
+
190
+ * 3.1.1 *
191
+
192
+ * Make #rollback_db_transaction smarter.
193
+
194
+ * Provide a method to override for the quoted string prefix. Not a config because trumping this method will
195
+ have drastically bad results. Fixes #124
196
+
197
+ * Allow :limit/:offset to be used with fully qualified table and column in :select.
198
+
199
+
200
+ * 3.1.0 *
201
+
202
+ * Add support/test around handling of float/real column types [Lucas Maxwell]
203
+
204
+ * Make auto reconnect duration configurable. Fixes #109 [David Chelimsky]
205
+
206
+ * Quote most time objects to use ISO8601 format to be multi-language dateformat compatible. The [datetime] data type is
207
+ automatically limited to milliseconds while [time] & [datetimeoffset] have full support. Even included a Date/Time
208
+ ActiveSupport formatter that is used per the language settings of the connection.
209
+
210
+ * Include a visit_Arel_Nodes_UpdateStatement method in our Arel visitor to add a limit/top for update
211
+ that has order and no limit/top. https://github.com/rails/rails/commit/787194ee43ab1fb0a7dc8bfbbfbd5079b047d833
212
+
213
+ * Allow drop_database to be called even when DB does not exist.
214
+
215
+ * Remove totally broken ADONET connection mode. Want it back, submit a patch.
216
+
217
+ * Schema reflection now finds primary key for all occasions. Fixed #60 [Boško Ivanišević]
218
+
219
+ * Allow complex order objects to not be molested by our visitor overrides. Fixes #99
220
+
221
+ * Default unicode datatypes!
222
+
223
+ * New #lowercase_schema_reflection configuration that allows you to downcase all tables and columns.
224
+ Good for legacy databases. Fixes #86. Thanks @dmajkic.
225
+
226
+ * Rails 3.1 with prepared statement support. Uses "EXEC sp_executesql ..." for just about everything now.
227
+
228
+
229
+ * 3.0.15 *
230
+
231
+ * Way better schema support! Thanks to @ianic! Fixes #61
232
+
233
+ * Warn of possible permission problems if "EXEC sp_helptext..." does not work view. Fixes #73.
234
+
235
+
236
+ * 3.0.13/3.0.14 *
237
+
238
+ * Allow TinyTDS/DBLIB mode to pass down :host/:port config options.
239
+
240
+
241
+ * 3.0.12 *
242
+
243
+ * Bug fix for previous TinyTDS lost connections.
244
+
245
+
246
+ * 3.0.11 *
247
+
248
+ * Azure compatibility.
249
+
250
+ * TinyTDS enhancements for lost connections. Default connection mode.
251
+
252
+
253
+ * 3.0.10 *
254
+
255
+ * Fix #rowtable_orders visitor helper to use first column if no pk column was found.
256
+
257
+ * Flatten sp_helpconstraint when looking for constraints just in case fks are present. Issue #64.
258
+
259
+ * Start to support 2011 code named "Denali".
260
+
261
+ * Limit and Offset can take SqlLiteral objects now.
262
+
263
+
264
+ * 3.0.9 *
265
+
266
+ * Fix array literal parsing bug for ruby 1.9.
267
+
268
+
269
+ * 3.0.8 *
270
+
271
+ * Support for ActiveRecord v3.0.3 and ARel v2.0.7
272
+
273
+
274
+ * 3.0.7 *
275
+
276
+ * Properly quote table names when reflecting on views.
277
+
278
+ * Add "dead or not enabled" to :dblib's lost connection messages.
279
+
280
+
281
+ * 3.0.6 *
282
+
283
+ * Maintenance release. Lock down to ActiveRecord 3.0.1 using ARel 1.0.0.
284
+
285
+
286
+ * 3.0.5 *
287
+
288
+ * Fixed native database type memoization, now at connection instance level. Fix #execute_procedure for :dblib mode to return indifferent access rows too.
289
+
290
+ * Make login timeout and query timeout backward database.yml friendly for :dblib mode.
291
+
292
+
293
+ * 3.0.4 *
294
+
295
+ * Add multiple results set support with #execute_procedure for :dblib mode. [Ken Collins]
296
+
297
+ * Simplify encoding support. [Ken Collins]
298
+
299
+ * Add binary timestamp datatype handling. [Erik Bryn]
300
+
301
+
302
+ * 3.0.3
303
+
304
+ * Add TinyTDS/dblib connection mode. [Ken Collins]
305
+
306
+
307
+ * 3.0.2
308
+
309
+ * Fix DSN'less code. [Erik Bryn]
310
+
311
+
312
+ * 3.0.1
313
+
314
+ * Support DSN'less connections. Resolves ticket 38.
315
+
316
+ * Support upcoming ruby odbc 0.99992
317
+
318
+
319
+ * 3.0.0
320
+
321
+ * Release rails 3 version!
322
+
323
+
324
+ * 2.3.8
325
+
326
+ * Properly quote all database names in rake helper methods. [Ken Collins]
3
327
 
4
328
 
5
329
  * 2.3.7
@@ -11,21 +335,21 @@ MASTER
11
335
 
12
336
  * Allow DNS's to not contain a database and use what is in database.yml [Marco Mastrodonato]
13
337
 
14
- * Rake tasks methods for vanallia rails :db namespace parity. [Ken Collins]
338
+ * Rake tasks methods for vanilla rails :db namespace parity. [Ken Collins]
15
339
 
16
340
  * IronRuby integrated security fixes [Jimmy Schementi]
17
341
 
18
342
 
19
343
  * 2.3.5
20
344
 
21
- * Initial IronRuby ADONET connection mode support baked right in. Removed most &block
22
- parameters, no handle/request object yielded anymore. Better abstraction and compliance
23
- per the ActiveRecord abstract adapter to not yielding handles for #execute and only for
24
- low level #select. Better wrapping of all queries at lowest level in #log so exceptions
25
- at anytime can be handled correctly by core AR. Critical for System::Data's command
26
- readers. Better abstraction for introspecting on #connection_mode. Added support for
345
+ * Initial IronRuby ADONET connection mode support baked right in. Removed most &block
346
+ parameters, no handle/request object yielded anymore. Better abstraction and compliance
347
+ per the ActiveRecord abstract adapter to not yielding handles for #execute and only for
348
+ low level #select. Better wrapping of all queries at lowest level in #log so exceptions
349
+ at anytime can be handled correctly by core AR. Critical for System::Data's command
350
+ readers. Better abstraction for introspecting on #connection_mode. Added support for
27
351
  running singular test cases via TextMate's Command-R. [Ken Collins]
28
-
352
+
29
353
  * Force a binary encoding on values coming in and out of those columns for ruby 1.9.
30
354
  Fixes ticket #33 [Jeroen Zwartepoorte]
31
355
 
@@ -36,7 +360,7 @@ MASTER
36
360
 
37
361
  * Qualify INFORMATION_SCHEMA.COLUMNS with a correct period DB name if present.
38
362
 
39
- * Allow adapter to return multipe results sets, for example from stored procedures. [Chris Hall]
363
+ * Allow adapter to return multiple results sets, for example from stored procedures. [Chris Hall]
40
364
 
41
365
 
42
366
  * 2.3.4
@@ -44,22 +368,22 @@ MASTER
44
368
  * For tables that named with schema(ex. rails.users), they could not get length of column.
45
369
  column of varchar(40) gets length => nil. Ticket #27 & #15 [Ken Tachiya]
46
370
 
47
- * Altered limited_update_conditions regex conditions, the .* would greedily fail
371
+ * Altered limited_update_conditions regex conditions, the .* would greedily fail
48
372
  if the where_sql had WHERE in a table or field, etc. [Ransom Briggs]
49
373
 
50
- * Changing test to allow ENV['ARUNIT_DB_NAME'] as the database name for the test units.
374
+ * Changing test to allow ENV['ARUNIT_DB_NAME'] as the database name for the test units.
51
375
  Matches up with AR conventions. [Ransom Briggs]
52
376
 
53
377
 
54
378
  2.3.3
55
-
56
- * Revert #ad83df82 and again cache column information at the connection's instance. The
379
+
380
+ * Revert #ad83df82 and again cache column information at the connection's instance. The
57
381
  previous commit was causing all sorts of view and schema reflection problems. [Ken Collins]
58
382
 
59
383
 
60
384
  2.3.2
61
385
 
62
- * Insert queries that include the word "insert" as a partial column name with the word
386
+ * Insert queries that include the word "insert" as a partial column name with the word
63
387
  "id" as a value were falsely being matched as identity inserts. [Sean Caffery/bfabry]
64
388
 
65
389
  * Delegate all low level #raw_connection calls to #raw_connection_run and #raw_connection_do
@@ -77,10 +401,10 @@ MASTER
77
401
  * Coerce a few tests that were failing in 2.3.x [Ken Collins]
78
402
 
79
403
  * Change column/view cache to happen at class level. Allows connection pool to share same
80
- caches as well as the ability to expire the caches when needed. Also fix change_column so
404
+ caches as well as the ability to expire the caches when needed. Also fix change_column so
81
405
  that exceptions are not raised when the column contains an existing default. [Ken Collins]
82
406
 
83
- * Allow query_requires_identity_insert? method to return quoted table name in situations where the
407
+ * Allow query_requires_identity_insert? method to return quoted table name in situations where the
84
408
  INSERT parts are not quoted themselves. [Gary/iawgens, Richard Penwell, Ken Collins]
85
409
 
86
410
  * Fixed namespace in calling test_sqlserver_odbc within test_unicode_types. [Gary/iawgens]
@@ -92,7 +416,7 @@ MASTER
92
416
 
93
417
  * Support Identity-key-column judgement on multiple schema environment [Ken Tachiya]
94
418
 
95
- * Add support for tinyint data types. In MySQL all these types would be boolean, however in
419
+ * Add support for tinyint data types. In MySQL all these types would be boolean, however in
96
420
  our adapter, they will use the full 1 => 255 Fixnum value as you would expect. [Ken Collins]
97
421
 
98
422
 
@@ -110,10 +434,10 @@ MASTER
110
434
 
111
435
  * Implement a new remove_default_constraint method that uses sp_helpconstraint [Ken Collins]
112
436
 
113
- * Use a lazy match in add_order_by_for_association_limiting! to allow sub selects to be used. Resolves
437
+ * Use a lazy match in add_order_by_for_association_limiting! to allow sub selects to be used. Resolves
114
438
  ticket #11.
115
439
 
116
- * Add default rake task back for testing. Runs the namespaced sqlserver:test_sqlserver_odbc.
440
+ * Add default rake task back for testing. Runs the namespaced sqlserver:test_sqlserver_odbc.
117
441
  Resolves ticket #10 [Ken Collins]
118
442
 
119
443
  * Default value detection in column_definitions is kinder to badly formatted, or long winded user
@@ -126,7 +450,7 @@ MASTER
126
450
 
127
451
  * Leave quoted column names as is. Resolves ticket #36 [Vince Puzzella]
128
452
 
129
- * Changing add_limit! in ActiveRecord::Base for SQLServer so that it passes through any scoped :order
453
+ * Changing add_limit! in ActiveRecord::Base for SQLServer so that it passes through any scoped :order
130
454
  parameters. Resolves ticket #35 [Murray Steele]
131
455
 
132
456
 
@@ -139,45 +463,45 @@ MASTER
139
463
 
140
464
  * 2.2.17 * (May 14th, 2009)
141
465
 
142
- * Add simplified type recognition for varchar(max) and nvarchar(max) under SQL Server 2005 to be a
466
+ * Add simplified type recognition for varchar(max) and nvarchar(max) under SQL Server 2005 to be a
143
467
  :text type. This ensures schema dumper does the right thing. Fixes ticket #30. [Ken Collins]
144
468
 
145
- * Tested ruby 1.9, ruby-odbc 0.9996, and DBI 0.4.1. Also added correct support for UTF-8 character
146
- encoding going in and out of the DB. See before gist http://gist.github.com/111709 and after gist
469
+ * Tested ruby 1.9, ruby-odbc 0.9996, and DBI 0.4.1. Also added correct support for UTF-8 character
470
+ encoding going in and out of the DB. See before gist http://gist.github.com/111709 and after gist
147
471
  http://gist.github.com/111719 [Ken Collins]
148
472
 
149
473
 
150
474
  * 2.2.16 * (April 21st, 2009)
151
475
 
152
- * Make add_limit_offset! only add locking hints (for tally) when the :lock option is present. Added tests
153
- to make sure tally SQL is augmented correctly and tests to make sure that add_lock! is doing what it needs
476
+ * Make add_limit_offset! only add locking hints (for tally) when the :lock option is present. Added tests
477
+ to make sure tally SQL is augmented correctly and tests to make sure that add_lock! is doing what it needs
154
478
  for deep sub selects in paginated results. [Ken Collins]
155
479
 
156
- * Add auto reconnect support utilizing a new #with_auto_reconnect block. By default each query run through
157
- the adapter will automatically reconnect at standard intervals, logging attempts along the way, till success
158
- or the original exception bubbles up. See docs for more details. Resolves ticket #18 [Ken Collins]
480
+ * Add auto reconnect support utilizing a new #with_auto_reconnect block. By default each query run through
481
+ the adapter will automatically reconnect at standard intervals, logging attempts along the way, till success
482
+ or the original exception bubbles up. See docs for more details. Resolves ticket #18 [Ken Collins]
159
483
 
160
- * Update internal helper method #orders_and_dirs_set to cope with an order clause like "description desc". This
484
+ * Update internal helper method #orders_and_dirs_set to cope with an order clause like "description desc". This
161
485
  resolves ticket #26 [Ken Collins]
162
486
 
163
- * Provide support for running queries at different isolation levels using #run_with_isolation_level method
164
- that can take a block or not. Also implement a #user_options method that reflects on the current user
487
+ * Provide support for running queries at different isolation levels using #run_with_isolation_level method
488
+ that can take a block or not. Also implement a #user_options method that reflects on the current user
165
489
  session values. Resolves #20 [Murray Steele]
166
490
 
167
491
 
168
492
  * 2.2.15 * (March 23rd, 2009)
169
493
 
170
- * Better add_lock! method that can add the lock to just about all the elements in the statement. This
171
- could be eager loaded associations, joins, etc. Done so that paginated results can easily add lock
172
- options for performance. Note, the tally count in add_limit_offset! use "WITH (NOLOCK)" explicitly
494
+ * Better add_lock! method that can add the lock to just about all the elements in the statement. This
495
+ could be eager loaded associations, joins, etc. Done so that paginated results can easily add lock
496
+ options for performance. Note, the tally count in add_limit_offset! use "WITH (NOLOCK)" explicitly
173
497
  as it can not hurt and is needed. [Ken Collins]
174
498
 
175
499
 
176
500
  * 2.2.14 * (March 17th, 2009)
177
501
 
178
- * Rails2.3 - Back passing tests on 2.2 work. Includes: (1) Created new test helpers that check ActiveRecord
179
- version strings so we can conditionally run 2.2 and 2.3 tests. (2) Making TransactionTestSqlserver use Ship vs
180
- Bird model. Also made it conditional run a few blocks for different versions of ActiveRecord. (3) Previous
502
+ * Rails2.3 - Back passing tests on 2.2 work. Includes: (1) Created new test helpers that check ActiveRecord
503
+ version strings so we can conditionally run 2.2 and 2.3 tests. (2) Making TransactionTestSqlserver use Ship vs
504
+ Bird model. Also made it conditional run a few blocks for different versions of ActiveRecord. (3) Previous
181
505
  JoinDependency#aliased_table_name_for is now only patched in ActiveRecord equal or greater than 2.3. [Ken Collins]
182
506
 
183
507
  * Rails2.3 - Implement new savepoint support [Ken Collins]
@@ -189,24 +513,24 @@ MASTER
189
513
  * Rails2.3 - Implement a custom ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation#aliased_table_name_for
190
514
  method that uses a Regexp.escape so that table/column quoting does not get ignored. [Ken Collins]
191
515
 
192
- * Rails2.3 - Implement #outside_transaction? and a new transaction test case to test some SQL Server
516
+ * Rails2.3 - Implement #outside_transaction? and a new transaction test case to test some SQL Server
193
517
  basic support while implementing this method. Future home of some savepoint tests too. [Ken Collins]
194
518
 
195
- * Rails2.3 - Coerced tests that ensure hash conditions on referenced tables are considered when eager
519
+ * Rails2.3 - Coerced tests that ensure hash conditions on referenced tables are considered when eager
196
520
  loading with limit/offset. Information on these changes and the ticket in rails are.
197
521
  http://github.com/rails/rails/commit/9a4d557713acb0fc8e80f61af18094034aca029a
198
522
  http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1404-conditions_tables-doesnt-understand-condition-hashes
199
523
 
200
524
  * Rails2.3 - Add coerced tests for true/false attributes in selects use SQL Server case statement. [Ken Collins]
201
525
 
202
- * Making sure that smalldatetime types are OK to use. Also fixed a bug in the #view_information method that
203
- checks to see if a view definition is equal to 4000 chars, meaning that it is most likely truncated and
526
+ * Making sure that smalldatetime types are OK to use. Also fixed a bug in the #view_information method that
527
+ checks to see if a view definition is equal to 4000 chars, meaning that it is most likely truncated and
204
528
  needs to use the backup method of sp_helptext to get it's view definition. [Ken Collins]
205
529
 
206
530
 
207
531
  * 2.2.13 * (February 10th, 2009)
208
532
 
209
- * Update #indexes to use unqualified table name. Fixes cases where users may decide to use table
533
+ * Update #indexes to use unqualified table name. Fixes cases where users may decide to use table
210
534
  name prefixes like 'dbo.'. [Ken Collins]
211
535
 
212
536
 
@@ -222,11 +546,11 @@ MASTER
222
546
 
223
547
  * 2.2.9 * (January 22nd, 2009)
224
548
 
225
- * Fixing a small bug in the deprecated DBI::Timestamp conversion so it correctly converts nanosecond whole
226
- numbers to back to pre type cast SQL Server milliseconds, ultimately allow ruby's Time#usec which is
549
+ * Fixing a small bug in the deprecated DBI::Timestamp conversion so it correctly converts nanosecond whole
550
+ numbers to back to pre type cast SQL Server milliseconds, ultimately allow ruby's Time#usec which is
227
551
  microseconds to be correct. [Ken Collins]
228
-
229
- * Sometimes views are more than 4000 chars long and will return NULL for the VIEW_DEFINITION. If so, use
552
+
553
+ * Sometimes views are more than 4000 chars long and will return NULL for the VIEW_DEFINITION. If so, use
230
554
  sp_helptext procedure as a backup method. [Ken Collins]
231
555
 
232
556
 
@@ -237,13 +561,13 @@ MASTER
237
561
 
238
562
  * 2.2.7 (January 9th, 2009)
239
563
 
240
- * Created a connection#execute_procedure method that takes can take any number of ruby objects as variables
241
- and quotes them according to the connection's rules. Also added an ActiveRecord::Base class level core
242
- extension that hooks into this. It also checks if the connection responds to #execute_procedure and if
564
+ * Created a connection#execute_procedure method that takes can take any number of ruby objects as variables
565
+ and quotes them according to the connection's rules. Also added an ActiveRecord::Base class level core
566
+ extension that hooks into this. It also checks if the connection responds to #execute_procedure and if
243
567
  not returns an empty array. [Ken Collins]
244
568
 
245
- * Added a #enable_default_unicode_types class attribute access to make all new added or changed string types
246
- like :string/:text default to unicode/national data types. See the README for full details. Added a rake
569
+ * Added a #enable_default_unicode_types class attribute access to make all new added or changed string types
570
+ like :string/:text default to unicode/national data types. See the README for full details. Added a rake
247
571
  task that assists setting this to true when running tests. [Ken Collins]
248
572
 
249
573
 
@@ -254,15 +578,15 @@ MASTER
254
578
 
255
579
  * 2.2.5 (January 4th, 2009)
256
580
 
257
- * Added a log_info_schema_queries class attribute and make all queries to INFORMATION_SCHEMA silent by
581
+ * Added a log_info_schema_queries class attribute and make all queries to INFORMATION_SCHEMA silent by
258
582
  default. [Ken Collins]
259
583
 
260
584
  * Fix millisecond support in datetime columns. ODBC::Timestamp incorrectly takes SQL Server milliseconds
261
- and applies them as nanoseconds. We cope with this at the DBI layer by using SQLServerDBI::Type::SqlserverTimestamp
262
- class to parse the before type cast value appropriately. Also update the adapters #quoted_date method
585
+ and applies them as nanoseconds. We cope with this at the DBI layer by using SQLServerDBI::Type::SqlserverTimestamp
586
+ class to parse the before type cast value appropriately. Also update the adapters #quoted_date method
263
587
  to work more simply by converting ruby's #usec milliseconds to SQL Server microseconds. [Ken Collins]
264
588
 
265
- * Core extensions for ActiveRecord now reflect on the connection before doing SQL Server things. Now
589
+ * Core extensions for ActiveRecord now reflect on the connection before doing SQL Server things. Now
266
590
  this adapter is compatible for using with other adapters. [Ken Collins]
267
591
 
268
592
 
@@ -273,9 +597,9 @@ MASTER
273
597
 
274
598
  * 2.2.3 (December 5th, 2008)
275
599
 
276
- * Changing back to using real table name in column_definitions. Makes sure views get back only the columns
277
- that are defined for them with correct names, etc. Now supporting views by looking for NULL default and
278
- then if table name is a view, perform a targeted with sub select to the real table name and column name
600
+ * Changing back to using real table name in column_definitions. Makes sure views get back only the columns
601
+ that are defined for them with correct names, etc. Now supporting views by looking for NULL default and
602
+ then if table name is a view, perform a targeted with sub select to the real table name and column name
279
603
  to find true default. [Ken Collins]
280
604
 
281
605
  * Ensure that add_limit_offset! does not alter sub queries. [Erik Bryn]
@@ -290,10 +614,10 @@ MASTER
290
614
 
291
615
  2.2.1 (November 25th, 2008)
292
616
 
293
- * Add identity insert support for views. Cache #views so that identity #table_name_or_views_table_name
617
+ * Add identity insert support for views. Cache #views so that identity #table_name_or_views_table_name
294
618
  will run quickly. [Ken Collins]
295
619
 
296
- * Add views support. ActiveRecord classes can use views. The connection now has a #views method and
620
+ * Add views support. ActiveRecord classes can use views. The connection now has a #views method and
297
621
  #table_exists? will now fall back to checking views too. [Ken Collins]
298
622
 
299
623
 
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008
1
+ Copyright (c) 2008-2011
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.2.18
@@ -0,0 +1,42 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module Sqlserver
4
+ module CoreExt
5
+ module ActiveRecord
6
+
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ class_attribute :coerced_sqlserver_date_columns, :coerced_sqlserver_time_columns
11
+ self.coerced_sqlserver_date_columns = Set.new
12
+ self.coerced_sqlserver_time_columns = Set.new
13
+ end
14
+
15
+ module ClassMethods
16
+
17
+ def execute_procedure(proc_name, *variables)
18
+ if connection.respond_to?(:execute_procedure)
19
+ connection.execute_procedure(proc_name,*variables)
20
+ else
21
+ []
22
+ end
23
+ end
24
+
25
+ def coerce_sqlserver_date(*attributes)
26
+ self.coerced_sqlserver_date_columns += attributes.map(&:to_s)
27
+ end
28
+
29
+ def coerce_sqlserver_time(*attributes)
30
+ self.coerced_sqlserver_time_columns += attributes.map(&:to_s)
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+
42
+ ActiveRecord::Base.send :include, ActiveRecord::ConnectionAdapters::Sqlserver::CoreExt::ActiveRecord