activerecord-sqlserver-adapter 3.1.1 → 3.2.18

Sign up to get free protection for your applications and to get access to all the features.
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,7 +1,197 @@
1
+ * 3.2.18 *
2
+
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
+
1
189
 
2
190
  * 3.1.1 *
3
191
 
4
- * Provide a method to override for the quoted string prefix. Not a config because trumping this method will
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
5
195
  have drastically bad results. Fixes #124
6
196
 
7
197
  * Allow :limit/:offset to be used with fully qualified table and column in :select.
@@ -14,12 +204,12 @@
14
204
  * Make auto reconnect duration configurable. Fixes #109 [David Chelimsky]
15
205
 
16
206
  * Quote most time objects to use ISO8601 format to be multi-language dateformat compatible. The [datetime] data type is
17
- automatically limited to milliseconds while [time] & [datetimeoffset] have full support. Even included a Date/Time
207
+ automatically limited to milliseconds while [time] & [datetimeoffset] have full support. Even included a Date/Time
18
208
  ActiveSupport formatter that is used per the language settings of the connection.
19
209
 
20
210
  * Include a visit_Arel_Nodes_UpdateStatement method in our Arel visitor to add a limit/top for update
21
211
  that has order and no limit/top. https://github.com/rails/rails/commit/787194ee43ab1fb0a7dc8bfbbfbd5079b047d833
22
-
212
+
23
213
  * Allow drop_database to be called even when DB does not exist.
24
214
 
25
215
  * Remove totally broken ADONET connection mode. Want it back, submit a patch.
@@ -81,7 +271,7 @@
81
271
  * Support for ActiveRecord v3.0.3 and ARel v2.0.7
82
272
 
83
273
 
84
- * 3.0.7 *
274
+ * 3.0.7 *
85
275
 
86
276
  * Properly quote table names when reflecting on views.
87
277
 
@@ -121,7 +311,7 @@
121
311
 
122
312
  * 3.0.1
123
313
 
124
- * Support DSN'less connections. Resolves ticket 38.
314
+ * Support DSN'less connections. Resolves ticket 38.
125
315
 
126
316
  * Support upcoming ruby odbc 0.99992
127
317
 
@@ -152,14 +342,14 @@
152
342
 
153
343
  * 2.3.5
154
344
 
155
- * Initial IronRuby ADONET connection mode support baked right in. Removed most &block
156
- parameters, no handle/request object yielded anymore. Better abstraction and compliance
157
- per the ActiveRecord abstract adapter to not yielding handles for #execute and only for
158
- low level #select. Better wrapping of all queries at lowest level in #log so exceptions
159
- at anytime can be handled correctly by core AR. Critical for System::Data's command
160
- 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
161
351
  running singular test cases via TextMate's Command-R. [Ken Collins]
162
-
352
+
163
353
  * Force a binary encoding on values coming in and out of those columns for ruby 1.9.
164
354
  Fixes ticket #33 [Jeroen Zwartepoorte]
165
355
 
@@ -178,22 +368,22 @@
178
368
  * For tables that named with schema(ex. rails.users), they could not get length of column.
179
369
  column of varchar(40) gets length => nil. Ticket #27 & #15 [Ken Tachiya]
180
370
 
181
- * Altered limited_update_conditions regex conditions, the .* would greedily fail
371
+ * Altered limited_update_conditions regex conditions, the .* would greedily fail
182
372
  if the where_sql had WHERE in a table or field, etc. [Ransom Briggs]
183
373
 
184
- * 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.
185
375
  Matches up with AR conventions. [Ransom Briggs]
186
376
 
187
377
 
188
378
  2.3.3
189
-
190
- * 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
191
381
  previous commit was causing all sorts of view and schema reflection problems. [Ken Collins]
192
382
 
193
383
 
194
384
  2.3.2
195
385
 
196
- * 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
197
387
  "id" as a value were falsely being matched as identity inserts. [Sean Caffery/bfabry]
198
388
 
199
389
  * Delegate all low level #raw_connection calls to #raw_connection_run and #raw_connection_do
@@ -211,10 +401,10 @@
211
401
  * Coerce a few tests that were failing in 2.3.x [Ken Collins]
212
402
 
213
403
  * Change column/view cache to happen at class level. Allows connection pool to share same
214
- 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
215
405
  that exceptions are not raised when the column contains an existing default. [Ken Collins]
216
406
 
217
- * 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
218
408
  INSERT parts are not quoted themselves. [Gary/iawgens, Richard Penwell, Ken Collins]
219
409
 
220
410
  * Fixed namespace in calling test_sqlserver_odbc within test_unicode_types. [Gary/iawgens]
@@ -226,7 +416,7 @@
226
416
 
227
417
  * Support Identity-key-column judgement on multiple schema environment [Ken Tachiya]
228
418
 
229
- * 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
230
420
  our adapter, they will use the full 1 => 255 Fixnum value as you would expect. [Ken Collins]
231
421
 
232
422
 
@@ -244,10 +434,10 @@
244
434
 
245
435
  * Implement a new remove_default_constraint method that uses sp_helpconstraint [Ken Collins]
246
436
 
247
- * 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
248
438
  ticket #11.
249
439
 
250
- * 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.
251
441
  Resolves ticket #10 [Ken Collins]
252
442
 
253
443
  * Default value detection in column_definitions is kinder to badly formatted, or long winded user
@@ -260,7 +450,7 @@
260
450
 
261
451
  * Leave quoted column names as is. Resolves ticket #36 [Vince Puzzella]
262
452
 
263
- * 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
264
454
  parameters. Resolves ticket #35 [Murray Steele]
265
455
 
266
456
 
@@ -273,45 +463,45 @@
273
463
 
274
464
  * 2.2.17 * (May 14th, 2009)
275
465
 
276
- * 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
277
467
  :text type. This ensures schema dumper does the right thing. Fixes ticket #30. [Ken Collins]
278
468
 
279
- * Tested ruby 1.9, ruby-odbc 0.9996, and DBI 0.4.1. Also added correct support for UTF-8 character
280
- 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
281
471
  http://gist.github.com/111719 [Ken Collins]
282
472
 
283
473
 
284
474
  * 2.2.16 * (April 21st, 2009)
285
475
 
286
- * Make add_limit_offset! only add locking hints (for tally) when the :lock option is present. Added tests
287
- 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
288
478
  for deep sub selects in paginated results. [Ken Collins]
289
479
 
290
- * Add auto reconnect support utilizing a new #with_auto_reconnect block. By default each query run through
291
- the adapter will automatically reconnect at standard intervals, logging attempts along the way, till success
292
- 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]
293
483
 
294
- * 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
295
485
  resolves ticket #26 [Ken Collins]
296
486
 
297
- * Provide support for running queries at different isolation levels using #run_with_isolation_level method
298
- 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
299
489
  session values. Resolves #20 [Murray Steele]
300
490
 
301
491
 
302
492
  * 2.2.15 * (March 23rd, 2009)
303
493
 
304
- * Better add_lock! method that can add the lock to just about all the elements in the statement. This
305
- could be eager loaded associations, joins, etc. Done so that paginated results can easily add lock
306
- 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
307
497
  as it can not hurt and is needed. [Ken Collins]
308
498
 
309
499
 
310
500
  * 2.2.14 * (March 17th, 2009)
311
501
 
312
- * Rails2.3 - Back passing tests on 2.2 work. Includes: (1) Created new test helpers that check ActiveRecord
313
- version strings so we can conditionally run 2.2 and 2.3 tests. (2) Making TransactionTestSqlserver use Ship vs
314
- 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
315
505
  JoinDependency#aliased_table_name_for is now only patched in ActiveRecord equal or greater than 2.3. [Ken Collins]
316
506
 
317
507
  * Rails2.3 - Implement new savepoint support [Ken Collins]
@@ -323,24 +513,24 @@
323
513
  * Rails2.3 - Implement a custom ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation#aliased_table_name_for
324
514
  method that uses a Regexp.escape so that table/column quoting does not get ignored. [Ken Collins]
325
515
 
326
- * 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
327
517
  basic support while implementing this method. Future home of some savepoint tests too. [Ken Collins]
328
518
 
329
- * 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
330
520
  loading with limit/offset. Information on these changes and the ticket in rails are.
331
521
  http://github.com/rails/rails/commit/9a4d557713acb0fc8e80f61af18094034aca029a
332
522
  http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1404-conditions_tables-doesnt-understand-condition-hashes
333
523
 
334
524
  * Rails2.3 - Add coerced tests for true/false attributes in selects use SQL Server case statement. [Ken Collins]
335
525
 
336
- * Making sure that smalldatetime types are OK to use. Also fixed a bug in the #view_information method that
337
- 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
338
528
  needs to use the backup method of sp_helptext to get it's view definition. [Ken Collins]
339
529
 
340
530
 
341
531
  * 2.2.13 * (February 10th, 2009)
342
532
 
343
- * 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
344
534
  name prefixes like 'dbo.'. [Ken Collins]
345
535
 
346
536
 
@@ -356,11 +546,11 @@
356
546
 
357
547
  * 2.2.9 * (January 22nd, 2009)
358
548
 
359
- * Fixing a small bug in the deprecated DBI::Timestamp conversion so it correctly converts nanosecond whole
360
- 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
361
551
  microseconds to be correct. [Ken Collins]
362
-
363
- * 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
364
554
  sp_helptext procedure as a backup method. [Ken Collins]
365
555
 
366
556
 
@@ -371,13 +561,13 @@
371
561
 
372
562
  * 2.2.7 (January 9th, 2009)
373
563
 
374
- * Created a connection#execute_procedure method that takes can take any number of ruby objects as variables
375
- and quotes them according to the connection's rules. Also added an ActiveRecord::Base class level core
376
- 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
377
567
  not returns an empty array. [Ken Collins]
378
568
 
379
- * Added a #enable_default_unicode_types class attribute access to make all new added or changed string types
380
- 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
381
571
  task that assists setting this to true when running tests. [Ken Collins]
382
572
 
383
573
 
@@ -388,15 +578,15 @@
388
578
 
389
579
  * 2.2.5 (January 4th, 2009)
390
580
 
391
- * 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
392
582
  default. [Ken Collins]
393
583
 
394
584
  * Fix millisecond support in datetime columns. ODBC::Timestamp incorrectly takes SQL Server milliseconds
395
- and applies them as nanoseconds. We cope with this at the DBI layer by using SQLServerDBI::Type::SqlserverTimestamp
396
- 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
397
587
  to work more simply by converting ruby's #usec milliseconds to SQL Server microseconds. [Ken Collins]
398
588
 
399
- * 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
400
590
  this adapter is compatible for using with other adapters. [Ken Collins]
401
591
 
402
592
 
@@ -407,9 +597,9 @@
407
597
 
408
598
  * 2.2.3 (December 5th, 2008)
409
599
 
410
- * Changing back to using real table name in column_definitions. Makes sure views get back only the columns
411
- that are defined for them with correct names, etc. Now supporting views by looking for NULL default and
412
- 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
413
603
  to find true default. [Ken Collins]
414
604
 
415
605
  * Ensure that add_limit_offset! does not alter sub queries. [Erik Bryn]
@@ -424,10 +614,10 @@
424
614
 
425
615
  2.2.1 (November 25th, 2008)
426
616
 
427
- * 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
428
618
  will run quickly. [Ken Collins]
429
619
 
430
- * 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
431
621
  #table_exists? will now fall back to checking views too. [Ken Collins]
432
622
 
433
623
 
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.2.18
@@ -1,9 +1,3 @@
1
- require 'set'
2
- require 'active_record/base'
3
- require 'active_record/version'
4
- require 'active_support/concern'
5
- require 'active_support/core_ext/class/attribute'
6
-
7
1
  module ActiveRecord
8
2
  module ConnectionAdapters
9
3
  module Sqlserver
@@ -46,4 +40,3 @@ end
46
40
 
47
41
 
48
42
  ActiveRecord::Base.send :include, ActiveRecord::ConnectionAdapters::Sqlserver::CoreExt::ActiveRecord
49
-
@@ -0,0 +1,97 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module Sqlserver
4
+ module CoreExt
5
+ module DatabaseStatements
6
+
7
+ # This is a copy of the current (3.1.3) ActiveRecord's transaction method. We should propose
8
+ # a patch to the default transaction method to make it more callback for adapters that want to
9
+ # do deadlock retry logic. Because this is a copy, we really need to keep an eye out on this when
10
+ # upgradding the adapter.
11
+ def transaction_with_retry_deadlock_victim(options = {})
12
+ options.assert_valid_keys :requires_new, :joinable
13
+
14
+ last_transaction_joinable = defined?(@transaction_joinable) ? @transaction_joinable : nil
15
+ if options.has_key?(:joinable)
16
+ @transaction_joinable = options[:joinable]
17
+ else
18
+ @transaction_joinable = true
19
+ end
20
+ requires_new = options[:requires_new] || !last_transaction_joinable
21
+
22
+ transaction_open = false
23
+ @_current_transaction_records ||= []
24
+
25
+ begin
26
+ if block_given?
27
+ if requires_new || open_transactions == 0
28
+ if open_transactions == 0
29
+ begin_db_transaction
30
+ elsif requires_new
31
+ create_savepoint
32
+ end
33
+ increment_open_transactions
34
+ transaction_open = true
35
+ @_current_transaction_records.push([])
36
+ end
37
+ yield
38
+ end
39
+ rescue Exception => database_transaction_rollback
40
+ if transaction_open && !outside_transaction?
41
+ transaction_open = false
42
+ decrement_open_transactions
43
+ # handle deadlock victim retries at the outermost transaction
44
+ if open_transactions == 0
45
+ if database_transaction_rollback.is_a?(::ActiveRecord::DeadlockVictim)
46
+ # SQL Server has already rolled back, so rollback activerecord's history
47
+ rollback_transaction_records(true)
48
+ retry
49
+ else
50
+ rollback_db_transaction
51
+ rollback_transaction_records(true)
52
+ end
53
+ else
54
+ rollback_to_savepoint
55
+ rollback_transaction_records(false)
56
+ end
57
+ end
58
+ raise unless database_transaction_rollback.is_a?(::ActiveRecord::Rollback)
59
+ end
60
+ ensure
61
+ @transaction_joinable = last_transaction_joinable
62
+
63
+ if outside_transaction?
64
+ @open_transactions = 0
65
+ elsif transaction_open
66
+ decrement_open_transactions
67
+ begin
68
+ if open_transactions == 0
69
+ commit_db_transaction
70
+ commit_transaction_records
71
+ else
72
+ release_savepoint
73
+ save_point_records = @_current_transaction_records.pop
74
+ unless save_point_records.blank?
75
+ @_current_transaction_records.push([]) if @_current_transaction_records.empty?
76
+ @_current_transaction_records.last.concat(save_point_records)
77
+ end
78
+ end
79
+ rescue Exception => database_transaction_rollback
80
+ if open_transactions == 0
81
+ rollback_db_transaction
82
+ rollback_transaction_records(true)
83
+ else
84
+ rollback_to_savepoint
85
+ rollback_transaction_records(false)
86
+ end
87
+ raise
88
+ end
89
+ end
90
+ end
91
+
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+
@@ -0,0 +1,41 @@
1
+ module ActiveRecord
2
+ module ConnectionAdapters
3
+ module Sqlserver
4
+ module CoreExt
5
+ module Explain
6
+
7
+ SQLSERVER_STATEMENT_PREFIX = "EXEC sp_executesql "
8
+ SQLSERVER_PARAM_MATCHER = /@\d+ =/
9
+
10
+ def exec_explain(queries)
11
+ unprepared_queries = queries.map { |sql, bind| [unprepare_sqlserver_statement(sql), bind] }
12
+ super(unprepared_queries)
13
+ end
14
+
15
+ private
16
+
17
+ # This is somewhat hacky, but it should reliably reformat our prepared sql statment
18
+ # which uses sp_executesql to just the first argument, then unquote it. Likewise our
19
+ # do_exec_query method should substitude the @n args withe the quoted values.
20
+ def unprepare_sqlserver_statement(sql)
21
+ if sql.starts_with?(SQLSERVER_STATEMENT_PREFIX)
22
+ executesql = sql.from(SQLSERVER_STATEMENT_PREFIX.length)
23
+ executesql_args = executesql.split(', ')
24
+ found_args = executesql_args.reject! { |arg| arg =~ SQLSERVER_PARAM_MATCHER }
25
+ executesql_args.pop if found_args && executesql_args.many?
26
+ executesql = executesql_args.join(', ').strip.match(/N'(.*)'/m)[1]
27
+ Utils.unquote_string(executesql)
28
+ else
29
+ sql
30
+ end
31
+ end
32
+
33
+
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ ActiveRecord::Base.extend ActiveRecord::ConnectionAdapters::Sqlserver::CoreExt::Explain
41
+ ActiveRecord::Relation.send :include, ActiveRecord::ConnectionAdapters::Sqlserver::CoreExt::Explain