activerecord-sqlserver-adapter-2000 3.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,400 @@
1
+
2
+ * 3.0.15 *
3
+
4
+ * Way better schema support! Thanks to @ianic! Fixes #61
5
+
6
+ * Warn of possible permission problems if "EXEC sp_helptext..." does not work view. Fixes #73.
7
+
8
+
9
+ * 3.0.13/3.0.14 *
10
+
11
+ * Allow TinyTDS/DBLIB mode to pass down :host/:port config options.
12
+
13
+
14
+ * 3.0.12 *
15
+
16
+ * Bug fix for previous TinyTDS lost connections.
17
+
18
+
19
+ * 3.0.11 *
20
+
21
+ * Azure compatibility.
22
+
23
+ * TinyTDS enhancements for lost connections. Default connection mode.
24
+
25
+
26
+ * 3.0.10 *
27
+
28
+ * Fix #rowtable_orders visitor helper to use first column if no pk column was found.
29
+
30
+ * Flatten sp_helpconstraint when looking for constraints just in case fks are present. Issue #64.
31
+
32
+ * Start to support 2011 code named "Denali".
33
+
34
+ * Limit and Offset can take SqlLiteral objects now.
35
+
36
+
37
+ * 3.0.9 *
38
+
39
+ * Fix array literal parsing bug for ruby 1.9.
40
+
41
+
42
+ * 3.0.8 *
43
+
44
+ * Support for ActiveRecord v3.0.3 and ARel v2.0.7
45
+
46
+
47
+ * 3.0.7 *
48
+
49
+ * Properly quote table names when reflecting on views.
50
+
51
+ * Add "dead or not enabled" to :dblib's lost connection messages.
52
+
53
+
54
+ * 3.0.6 *
55
+
56
+ * Maintenance release. Lock down to ActiveRecord 3.0.1 using ARel 1.0.0.
57
+
58
+
59
+ * 3.0.5 *
60
+
61
+ * Fixed native database type memoization, now at connection instance level. Fix #execute_procedure for :dblib mode to return indifferent access rows too.
62
+
63
+ * Make login timeout and query timeout backward database.yml friendly for :dblib mode.
64
+
65
+
66
+ * 3.0.4 *
67
+
68
+ * Add multiple results set support with #execute_procedure for :dblib mode. [Ken Collins]
69
+
70
+ * Simplify encoding support. [Ken Collins]
71
+
72
+ * Add binary timestamp datatype handling. [Erik Bryn]
73
+
74
+
75
+ * 3.0.3
76
+
77
+ * Add TinyTDS/dblib connection mode. [Ken Collins]
78
+
79
+
80
+ * 3.0.2
81
+
82
+ * Fix DSN'less code. [Erik Bryn]
83
+
84
+
85
+ * 3.0.1
86
+
87
+ * Support DSN'less connections. Resolves ticket 38.
88
+
89
+ * Support upcoming ruby odbc 0.99992
90
+
91
+
92
+ * 3.0.0
93
+
94
+ * Release rails 3 version!
95
+
96
+
97
+ * 2.3.8
98
+
99
+ * Properly quote all database names in rake helper methods. [Ken Collins]
100
+
101
+
102
+ * 2.3.7
103
+
104
+ * Correctly use :date/:time SQL types in 2008 [Ken Collins]
105
+
106
+
107
+ * 2.3.6
108
+
109
+ * Allow DNS's to not contain a database and use what is in database.yml [Marco Mastrodonato]
110
+
111
+ * Rake tasks methods for vanilla rails :db namespace parity. [Ken Collins]
112
+
113
+ * IronRuby integrated security fixes [Jimmy Schementi]
114
+
115
+
116
+ * 2.3.5
117
+
118
+ * Initial IronRuby ADONET connection mode support baked right in. Removed most &block
119
+ parameters, no handle/request object yielded anymore. Better abstraction and compliance
120
+ per the ActiveRecord abstract adapter to not yielding handles for #execute and only for
121
+ low level #select. Better wrapping of all queries at lowest level in #log so exceptions
122
+ at anytime can be handled correctly by core AR. Critical for System::Data's command
123
+ readers. Better abstraction for introspecting on #connection_mode. Added support for
124
+ running singular test cases via TextMate's Command-R. [Ken Collins]
125
+
126
+ * Force a binary encoding on values coming in and out of those columns for ruby 1.9.
127
+ Fixes ticket #33 [Jeroen Zwartepoorte]
128
+
129
+ * Using change_column will leave default if the type does not change or a new default
130
+ is not included. Fixes issue #22. [Ransom Briggs]
131
+
132
+ * Use correct SP name for sp_MSforeachtable so any collation can get to it. [7to3]
133
+
134
+ * Qualify INFORMATION_SCHEMA.COLUMNS with a correct period DB name if present.
135
+
136
+ * Allow adapter to return multiple results sets, for example from stored procedures. [Chris Hall]
137
+
138
+
139
+ * 2.3.4
140
+
141
+ * For tables that named with schema(ex. rails.users), they could not get length of column.
142
+ column of varchar(40) gets length => nil. Ticket #27 & #15 [Ken Tachiya]
143
+
144
+ * Altered limited_update_conditions regex conditions, the .* would greedily fail
145
+ if the where_sql had WHERE in a table or field, etc. [Ransom Briggs]
146
+
147
+ * Changing test to allow ENV['ARUNIT_DB_NAME'] as the database name for the test units.
148
+ Matches up with AR conventions. [Ransom Briggs]
149
+
150
+
151
+ 2.3.3
152
+
153
+ * Revert #ad83df82 and again cache column information at the connection's instance. The
154
+ previous commit was causing all sorts of view and schema reflection problems. [Ken Collins]
155
+
156
+
157
+ 2.3.2
158
+
159
+ * Insert queries that include the word "insert" as a partial column name with the word
160
+ "id" as a value were falsely being matched as identity inserts. [Sean Caffery/bfabry]
161
+
162
+ * Delegate all low level #raw_connection calls to #raw_connection_run and #raw_connection_do
163
+ which abstract out the low level modes in the connection options at that point. [Ken Collins]
164
+
165
+ * Remove DBI dependency and go straight ODBC for speed improvement [Erik Bryn]
166
+
167
+ * Leave order by alone when same column crosses two tables [Ransom Briggs]
168
+
169
+
170
+ * 2.3 * (December 1st, 2009)
171
+
172
+ * Table and column aliases can handle many. Resolves ticket #19 [stonegao]
173
+
174
+ * Coerce a few tests that were failing in 2.3.x [Ken Collins]
175
+
176
+ * Change column/view cache to happen at class level. Allows connection pool to share same
177
+ caches as well as the ability to expire the caches when needed. Also fix change_column so
178
+ that exceptions are not raised when the column contains an existing default. [Ken Collins]
179
+
180
+ * Allow query_requires_identity_insert? method to return quoted table name in situations where the
181
+ INSERT parts are not quoted themselves. [Gary/iawgens, Richard Penwell, Ken Collins]
182
+
183
+ * Fixed namespace in calling test_sqlserver_odbc within test_unicode_types. [Gary/iawgens]
184
+
185
+ * Columns with multi-line defaults work correctly. [bfabry]
186
+
187
+
188
+ * 2.2.22 * (October 15th, 2009)
189
+
190
+ * Support Identity-key-column judgement on multiple schema environment [Ken Tachiya]
191
+
192
+ * Add support for tinyint data types. In MySQL all these types would be boolean, however in
193
+ our adapter, they will use the full 1 => 255 Fixnum value as you would expect. [Ken Collins]
194
+
195
+
196
+ * 2.2.21 * (September 10th, 2009)
197
+
198
+ * Changes for gem best practices per http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
199
+ Details of such are as follows: [Ken Collins]
200
+ - Removed rails-sqlserver-2000-2005-adapter.rb load file for old github usage.
201
+ - Move the core_ext directory to active_record/connection_adapters/sqlserver_adapter/core_ext
202
+ - Renamespace SQLServerDBI to ActiveRecord::ConnectionAdapters::SQLServerCoreExtensions::DBI
203
+ - Renamespace ActiveRecord::ConnectionAdapters::SQLServerActiveRecordExtensions to ActiveRecord::ConnectionAdapters::SQLServerCoreExtensions::ActiveRecord
204
+
205
+
206
+ * 2.2.20 * (September 10th, 2009)
207
+
208
+ * Implement a new remove_default_constraint method that uses sp_helpconstraint [Ken Collins]
209
+
210
+ * Use a lazy match in add_order_by_for_association_limiting! to allow sub selects to be used. Resolves
211
+ ticket #11.
212
+
213
+ * Add default rake task back for testing. Runs the namespaced sqlserver:test_sqlserver_odbc.
214
+ Resolves ticket #10 [Ken Collins]
215
+
216
+ * Default value detection in column_definitions is kinder to badly formatted, or long winded user
217
+ defined functions, for default values. Resolves ticket #8 [Ken Collins]
218
+
219
+ * Make sure bigint SQL Server data type can be used and converted back to Bignum as expected. [Ken Collins]
220
+
221
+
222
+ * 2.2.19 * (June 19th, 2009)
223
+
224
+ * Leave quoted column names as is. Resolves ticket #36 [Vince Puzzella]
225
+
226
+ * Changing add_limit! in ActiveRecord::Base for SQLServer so that it passes through any scoped :order
227
+ parameters. Resolves ticket #35 [Murray Steele]
228
+
229
+
230
+ * 2.2.18 * (June 5th, 2009)
231
+
232
+ * Column reflection on table name rescues LoadError and a few others. Resolves tickets #25 & #33 [Ken Collins]
233
+
234
+ * Added 2008 support. Resolves ticket #32 [Ken Collins]
235
+
236
+
237
+ * 2.2.17 * (May 14th, 2009)
238
+
239
+ * Add simplified type recognition for varchar(max) and nvarchar(max) under SQL Server 2005 to be a
240
+ :text type. This ensures schema dumper does the right thing. Fixes ticket #30. [Ken Collins]
241
+
242
+ * Tested ruby 1.9, ruby-odbc 0.9996, and DBI 0.4.1. Also added correct support for UTF-8 character
243
+ encoding going in and out of the DB. See before gist http://gist.github.com/111709 and after gist
244
+ http://gist.github.com/111719 [Ken Collins]
245
+
246
+
247
+ * 2.2.16 * (April 21st, 2009)
248
+
249
+ * Make add_limit_offset! only add locking hints (for tally) when the :lock option is present. Added tests
250
+ to make sure tally SQL is augmented correctly and tests to make sure that add_lock! is doing what it needs
251
+ for deep sub selects in paginated results. [Ken Collins]
252
+
253
+ * Add auto reconnect support utilizing a new #with_auto_reconnect block. By default each query run through
254
+ the adapter will automatically reconnect at standard intervals, logging attempts along the way, till success
255
+ or the original exception bubbles up. See docs for more details. Resolves ticket #18 [Ken Collins]
256
+
257
+ * Update internal helper method #orders_and_dirs_set to cope with an order clause like "description desc". This
258
+ resolves ticket #26 [Ken Collins]
259
+
260
+ * Provide support for running queries at different isolation levels using #run_with_isolation_level method
261
+ that can take a block or not. Also implement a #user_options method that reflects on the current user
262
+ session values. Resolves #20 [Murray Steele]
263
+
264
+
265
+ * 2.2.15 * (March 23rd, 2009)
266
+
267
+ * Better add_lock! method that can add the lock to just about all the elements in the statement. This
268
+ could be eager loaded associations, joins, etc. Done so that paginated results can easily add lock
269
+ options for performance. Note, the tally count in add_limit_offset! use "WITH (NOLOCK)" explicitly
270
+ as it can not hurt and is needed. [Ken Collins]
271
+
272
+
273
+ * 2.2.14 * (March 17th, 2009)
274
+
275
+ * Rails2.3 - Back passing tests on 2.2 work. Includes: (1) Created new test helpers that check ActiveRecord
276
+ version strings so we can conditionally run 2.2 and 2.3 tests. (2) Making TransactionTestSqlserver use Ship vs
277
+ Bird model. Also made it conditional run a few blocks for different versions of ActiveRecord. (3) Previous
278
+ JoinDependency#aliased_table_name_for is now only patched in ActiveRecord equal or greater than 2.3. [Ken Collins]
279
+
280
+ * Rails2.3 - Implement new savepoint support [Ken Collins]
281
+ http://rails.lighthouseapp.com/projects/8994/tickets/383
282
+ http://www.codeproject.com/KB/database/sqlservertransactions.aspx
283
+
284
+ * Rails2.3 - Coerce NestedScopingTest#test_merged_scoped_find to use correct regexp for adapter. [Ken Collins]
285
+
286
+ * Rails2.3 - Implement a custom ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation#aliased_table_name_for
287
+ method that uses a Regexp.escape so that table/column quoting does not get ignored. [Ken Collins]
288
+
289
+ * Rails2.3 - Implement #outside_transaction? and a new transaction test case to test some SQL Server
290
+ basic support while implementing this method. Future home of some savepoint tests too. [Ken Collins]
291
+
292
+ * Rails2.3 - Coerced tests that ensure hash conditions on referenced tables are considered when eager
293
+ loading with limit/offset. Information on these changes and the ticket in rails are.
294
+ http://github.com/rails/rails/commit/9a4d557713acb0fc8e80f61af18094034aca029a
295
+ http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1404-conditions_tables-doesnt-understand-condition-hashes
296
+
297
+ * Rails2.3 - Add coerced tests for true/false attributes in selects use SQL Server case statement. [Ken Collins]
298
+
299
+ * Making sure that smalldatetime types are OK to use. Also fixed a bug in the #view_information method that
300
+ checks to see if a view definition is equal to 4000 chars, meaning that it is most likely truncated and
301
+ needs to use the backup method of sp_helptext to get it's view definition. [Ken Collins]
302
+
303
+
304
+ * 2.2.13 * (February 10th, 2009)
305
+
306
+ * Update #indexes to use unqualified table name. Fixes cases where users may decide to use table
307
+ name prefixes like 'dbo.'. [Ken Collins]
308
+
309
+
310
+ * 2.2.12 * (February 8th, 2009)
311
+
312
+ * Update table_exists? to work with qualified table names that may include an user prefix. [Ken Collins]
313
+
314
+
315
+ * 2.2.10/11 * (January 22nd, 2009)
316
+
317
+ * Add a rails-sqlserver-2000-2005-adapter.rb file so that long :lib option for config.gem is no longer needed.
318
+
319
+
320
+ * 2.2.9 * (January 22nd, 2009)
321
+
322
+ * Fixing a small bug in the deprecated DBI::Timestamp conversion so it correctly converts nanosecond whole
323
+ numbers to back to pre type cast SQL Server milliseconds, ultimately allow ruby's Time#usec which is
324
+ microseconds to be correct. [Ken Collins]
325
+
326
+ * Sometimes views are more than 4000 chars long and will return NULL for the VIEW_DEFINITION. If so, use
327
+ sp_helptext procedure as a backup method. [Ken Collins]
328
+
329
+
330
+ * 2.2.8 (January 9th, 2009)
331
+
332
+ * Update execute_procedure method a bit to remove excess code. [Ken Collins]
333
+
334
+
335
+ * 2.2.7 (January 9th, 2009)
336
+
337
+ * Created a connection#execute_procedure method that takes can take any number of ruby objects as variables
338
+ and quotes them according to the connection's rules. Also added an ActiveRecord::Base class level core
339
+ extension that hooks into this. It also checks if the connection responds to #execute_procedure and if
340
+ not returns an empty array. [Ken Collins]
341
+
342
+ * Added a #enable_default_unicode_types class attribute access to make all new added or changed string types
343
+ like :string/:text default to unicode/national data types. See the README for full details. Added a rake
344
+ task that assists setting this to true when running tests. [Ken Collins]
345
+
346
+
347
+ * 2.2.6 (January 8th, 2009)
348
+
349
+ * Introduced a bug in 2.2.5 in the #add_order! core ext for ActiveRecord. Fixed [Ken Collins]
350
+
351
+
352
+ * 2.2.5 (January 4th, 2009)
353
+
354
+ * Added a log_info_schema_queries class attribute and make all queries to INFORMATION_SCHEMA silent by
355
+ default. [Ken Collins]
356
+
357
+ * Fix millisecond support in datetime columns. ODBC::Timestamp incorrectly takes SQL Server milliseconds
358
+ and applies them as nanoseconds. We cope with this at the DBI layer by using SQLServerDBI::Type::SqlserverTimestamp
359
+ class to parse the before type cast value appropriately. Also update the adapters #quoted_date method
360
+ to work more simply by converting ruby's #usec milliseconds to SQL Server microseconds. [Ken Collins]
361
+
362
+ * Core extensions for ActiveRecord now reflect on the connection before doing SQL Server things. Now
363
+ this adapter is compatible for using with other adapters. [Ken Collins]
364
+
365
+
366
+ * 2.2.4 (December 5th, 2008)
367
+
368
+ * Fix a type left in #views_real_column_name. Also cache #view_information lookups. [Ken Collins]
369
+
370
+
371
+ * 2.2.3 (December 5th, 2008)
372
+
373
+ * Changing back to using real table name in column_definitions. Makes sure views get back only the columns
374
+ that are defined for them with correct names, etc. Now supporting views by looking for NULL default and
375
+ then if table name is a view, perform a targeted with sub select to the real table name and column name
376
+ to find true default. [Ken Collins]
377
+
378
+ * Ensure that add_limit_offset! does not alter sub queries. [Erik Bryn]
379
+
380
+
381
+ 2.2.2 (December 2nd, 2008)
382
+
383
+ * Add support for view defaults by making column_definitions use real table name for schema info. [Ken Collins]
384
+
385
+ * Include version in connection method and inspection. [Ken Collins]
386
+
387
+
388
+ 2.2.1 (November 25th, 2008)
389
+
390
+ * Add identity insert support for views. Cache #views so that identity #table_name_or_views_table_name
391
+ will run quickly. [Ken Collins]
392
+
393
+ * Add views support. ActiveRecord classes can use views. The connection now has a #views method and
394
+ #table_exists? will now fall back to checking views too. [Ken Collins]
395
+
396
+
397
+ 2.2.0 (November 21st, 2008)
398
+
399
+ * Release for rails 2.2.2. Many many changes. [Ken Collins], [Murray Steele], [Shawn Balestracci], [Joe Rafaniello]
400
+
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2010
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,176 @@
1
+
2
+ == Fork of SQL Server 2005/2008 & Azure Adapter For ActiveRecord
3
+
4
+ The SQL Server adapter for ActiveRecord. This fork simply adds SQL Server 2000 to the list of supported versions. For SQL Server 2000 support, use the sqlserver2000 branch.
5
+
6
+
7
+ == What's New
8
+
9
+ * New dblib connection mode using TinyTds!
10
+ * Rails 3 support!
11
+
12
+
13
+ ==== Testing Rake Tasks Support
14
+
15
+ This is a long story, but if you are not working with a legacy database and you can trust your schema.rb to setup you local development or test database, then we have adapter level support for rails :db rake tasks. Please read this wiki page for full details.
16
+
17
+ http://wiki.github.com/rails-sqlserver/activerecord-sqlserver-adapter/rails-db-rake-tasks
18
+
19
+
20
+ ==== Date/Time Data Type Hinting
21
+
22
+ SQL Server 2005 does not include a native data type for just 'date' or 'time', it only has 'datetime'. To pass the ActiveRecord tests we implemented two simple class methods that can teach your models to coerce column information to be cast correctly. Simply pass a list of symbols to either the <tt>coerce_sqlserver_date</tt> or <tt>coerce_sqlserver_time</tt> methods that correspond to 'datetime' columns that need to be cast correctly.
23
+
24
+ class Topic < ActiveRecord::Base
25
+ coerce_sqlserver_date :last_read
26
+ coerce_sqlserver_time :bonus_time
27
+ end
28
+
29
+ This implementation has some limitations. To date we can only coerce date/time types for models that conform to the expected ActiveRecord class to table naming conventions. So a table of 'foo_bar_widgets' will look for coerced column types in the FooBarWidget class.
30
+
31
+
32
+ ==== Executing Stored Procedures
33
+
34
+ Every class that sub classes ActiveRecord::Base will now have an execute_procedure class method to use. This method takes the name of the stored procedure which can be a string or symbol and any number of variables to pass to the procedure. Arguments will automatically be quoted per the connection's standards as normal. For example.
35
+
36
+ Account.execute_procedure :update_totals, 'admin', nil, true
37
+
38
+
39
+ ==== Native Data Type Support
40
+
41
+ Currently the following custom data types have been tested for schema definitions.
42
+
43
+ * char
44
+ * nchar
45
+ * nvarchar
46
+ * ntext
47
+ * varchar(max)
48
+ * nvarchar(max)
49
+
50
+ For example:
51
+
52
+ create_table :sql_server_custom_types, :force => true do |t|
53
+ t.column :ten_code, :char, :limit => 10
54
+ t.column :ten_code_utf8, :nchar, :limit => 10
55
+ t.column :title_utf8, :nvarchar
56
+ t.column :body, :varchar_max # Creates varchar(max)
57
+ t.column :body_utf8, :ntext
58
+ t.column :body2_utf8, :nvarchar_max # Creates nvarchar(max)
59
+ end
60
+
61
+ Manually creating a varchar(max) is not necessary since this is the default type created when specifying a :text field. As time goes on we will be testing other SQL Server specific data types are handled correctly when created in a migration.
62
+
63
+
64
+ ==== Native Text/String/Binary Data Type Accessor
65
+
66
+ To pass the ActiveRecord tests we had to implement an class accessor for the native type created for :text columns. By default any :text column created by migrations will create a 'varchar(max)' data type. This type can be queried using the SQL = operator and has plenty of storage space which is why we made it the default. If for some reason you want to change the data type created during migrations you can configure this line to your liking in a config/initializers file.
67
+
68
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_text_database_type = 'varchar(8000)'
69
+
70
+ Also, there is a class attribute setter for the native string database type. This is the same for all SQL Server versions, 'varchar'. However it can be used instead of the #enable_default_unicode_types below for finer grain control over which types you want unicode safe when adding or changing the schema.
71
+
72
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_string_database_type = 'nvarchar'
73
+
74
+ By default any :binary column created by migrations will create a 'varbinary(max)' data type. This too can be set using an initializer.
75
+
76
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_binary_database_type = 'image'
77
+
78
+
79
+ ==== Setting Unicode Types As Default
80
+
81
+ By default the adapter will use non-unicode safe data types for :string and :text types when defining/changing the schema. If you choose, you can set the following class attribute in a config/initializers file that will change this behavior. When set to true it has the equivalent meaning as the two lower items. These examples show detail level alternatives to achieve similar effects.
82
+
83
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.enable_default_unicode_types = true
84
+
85
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_text_database_type = 'nvarchar(max)'
86
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_string_database_type = 'nvarchar'
87
+
88
+ It is important to remember that unicode types in SQL Server have approximately half the storage capacity as their counter parts. So where a normal string would max out at (8000) a unicode string will top off at (4000).
89
+
90
+
91
+ ==== Schema Information Logging
92
+
93
+ By default all queries to the INFORMATION_SCHEMA table is silenced. If you think logging these queries are useful, you can enable it by adding this like to a initializer file.
94
+
95
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.log_info_schema_queries = true
96
+
97
+
98
+ ==== Auto Connecting
99
+
100
+ By default the adapter will auto connect to lost DB connections. For every query it will retry at intervals of 2, 4, 8, 16 and 32 seconds. During each retry it will callback out to ActiveRecord::Base.did_retry_sqlserver_connection(connection,count). When all retries fail, it will callback to ActiveRecord::Base.did_lose_sqlserver_connection(connection). Both implementations of these methods are to write to the rails logger, however, they make great override points for notifications like Hoptoad. If you want to disable automatic reconnections use the following in an initializer.
101
+
102
+ ActiveRecord::ConnectionAdapters::SQLServerAdapter.auto_connect = false
103
+
104
+
105
+ == Versions
106
+
107
+ It is our goal to match the adapter version with each version of rails. However we will track our own tiny version independent of ActiveRecord. For example, an adapter version of 2.3.x will work on any 2.3.x version of ActiveRecord. Version 3.x will track ActiveRecord 3. This convention will be used in both the Git tags as well as the gems versioning.
108
+
109
+
110
+ == Installation
111
+
112
+ You will need Ruby ODBC. If you are using the adapter under 1.9, then you need at least ruby-odbc version 0.99992. ODBC is the preferred mode, however if you are using IronRuby you can use the ADONET connection mode which uses native System.Data connection. Other connection modes may be supported, possibly a straight FreeTDS layer. The sky is the limit for optional transports. If you are interested in helping, open a ticket and submit a patch. Or start a conversation on the Google Group.
113
+
114
+ $ gem install activerecord-sqlserver-adapter
115
+
116
+ Optionally configure your gem dependencies in your Gemfile.
117
+
118
+ gem 'activerecord-sqlserver-adapter', '3.x.xx'
119
+
120
+ If you have any troubles installing the lower level libraries for the adapter, please consult the wiki pages for various platform installation guides. Tons of good info can be found and we ask that you contribute too!
121
+
122
+ http://wiki.github.com/rails-sqlserver/activerecord-sqlserver-adapter/platform-installation
123
+
124
+
125
+
126
+ == IronRuby ADONET Mode
127
+
128
+ A few details on this implementation. All that is needed in your database.yml configuration file is "mode: adonet" vs "odbc" and if you are running IronRuby, the connection will be native. You can also specify an "integrated_security: true" option in your configuration, remember to remove the username/password options too. To use this adapter, you will not need need ANY DBI middle layer or special extension gems to the adapter.
129
+
130
+ This adapter is opinionated in regards to IronRuby on types going in and out of the DB. For example strings will be String, not System::String and DateTime vs System::Datetime. There are many more examples but the rule of thumb is that the types will be simple types that correlate to a standard Ruby implementation. We enforce this basic rule because it is necessary to pass the tests and let the framework do its job. We recommend sticking to native Ruby types in your application code too.
131
+
132
+ The adapter establishes a System::Data::SqlClient connection that has both MultipleActiveResultSets (MARS) and Pooling turned off. There are good reasons for this one because the connection would not work otherwise for all the code issued by ActiveRecord. Remember too that ActiveRecord has it's own connection pooling and these underlying features like MARS/Pooling work against the adapter code.
133
+
134
+ Currently IronRuby is passing most of the ActiveRecord and Adapter tests. Here is a list of the ones remaining. Some are in the adapter's realm and some are in Marshaling area of IronRuby's core to fix. Feel like helping knock these out? Submit a patch to github issues.
135
+
136
+ http://gist.github.com/381101
137
+
138
+
139
+
140
+ == Contributing
141
+
142
+ If you’d like to contribute a feature or bugfix, thanks! To make sure your fix/feature has a high chance of being added, please read the following guidelines. First, ask on the Google list, IRC, or post a ticket on github issues. Second, make sure there are tests! We will not accept any patch that is not tested. Please read the RUNNING_UNIT_TESTS file for the details of how to run the unit tests.
143
+
144
+ * Github: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter
145
+ * Google Group: http://groups.google.com/group/rails-sqlserver-adapter
146
+ * IRC Room: #rails-sqlserver on irc.freenode.net
147
+
148
+
149
+
150
+ == Credits & Contributions
151
+
152
+ Many many people have contributed. If you do not see your name here and it should be let us know. Also, many thanks go out to those that have pledged financial contributions.
153
+
154
+ === Contributers
155
+ Up-to-date list of contributors: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/contributors
156
+
157
+ * metaskills (Ken Collins)
158
+ * h-lame (Murray Steele)
159
+ * vegantech
160
+ * cjheath (Clifford Heath)
161
+ * jrafanie (Joe Rafaniello)
162
+ * nerdrew (Andrew Ryan)
163
+ * snowblink (Jonathan Lim)
164
+ * koppen (Jakob Skjerning)
165
+ * ebryn (Erik Bryn)
166
+ * adzap (Adam Meehan)
167
+ * neomindryan (Ryan Findley)
168
+ * jeremydurham (Jeremy Durham)
169
+
170
+ === Donators
171
+ http://pledgie.com/campaigns/11630
172
+
173
+ == License
174
+
175
+ Copyright © 2008-2010. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
176
+