Skip to content

Commit 93801bb

Browse files
committed
Adding more info about what's new in this version.
1 parent 4d7ffe5 commit 93801bb

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

README.rdoc

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,39 @@ The SQL Server adapter for rails is back for ActiveRecord 2.2 and up! We are cur
66

77
== What's New
88

9-
* Enabled support for DDL transactions.
10-
* Micro second support. Time#usec is automatically converted to SQL Server's 3.33 millisecond limitation.
11-
* Datetime data type before type casting are represented correctly. For example: 1998-01-01 23:59:59.997
12-
* Implementation for #disable_referential_integrity used by ActiveRecord::Fixtures class.
13-
* Pessimistic locking suppot. See the #add_lock! method for details.
14-
* Enabled #case_sensitive_equality_operator used by unique validations.
15-
* Unicode character support for nchar, nvarchar and ntext date types.
9+
* Enabled support for DDL transactions.
10+
* Micro second support. Time#usec is automatically converted to SQL Server's 3.33 millisecond limitation.
11+
* Datetime data types before type casting are represented correctly. For example: 1998-01-01 23:59:59.997
12+
* Implementation for #disable_referential_integrity used by ActiveRecord::Fixtures class.
13+
* Pessimistic locking suppot. See the #add_lock! method for details.
14+
* Enabled #case_sensitive_equality_operator used by unique validations.
15+
* Unicode character support for nchar, nvarchar and ntext data types.
1616

17+
==== Native Text Data Type Accessor
1718

19+
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 these native types.
1820

19-
==== Native Text Datetype Accessor
21+
* SQL Server 2000 is 'text'
22+
* SQL Server 2005 is 'varchar(max)'
2023

21-
native_text_database_type
24+
During testing this type is set to 'varchar(8000)' for both versions. The reason is that rails expects to be able to use SQL = operators on text data types and this is not possible with a native 'text' data type in SQL Server. The default 'varchar(max)' for SQL Server 2005 can be queried using the SQL = operator and has plenty of storage space which is why we made it the default for 2005. If for some reason you want to change the data type created during migrations for any SQL Server version, you can include this line in your environment.rb file.
2225

23-
'varchar(max)' : 'text'
24-
25-
==== Date/Time Datatype Hinting
26+
ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_text_database_type = 'varchar(8000)'
2627

28+
==== Date/Time Data Type Hinting
2729

30+
Both SQL Server 2000 and 2005 do not have native data types 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 past 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.
2831

2932
class Topic < ActiveRecord::Base
3033
coerce_sqlserver_date :last_read
3134
coerce_sqlserver_time :bonus_time
3235
end
3336

37+
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 convention. So a table of 'foo_bar_widgets' will look for coerced types in the FooBarWidget class if it exists.
38+
3439

3540
== Installation
36-
41+
3742
This method is unconfirmed. You can install the adapter as a gem using the following command. Once I confirm this I can give you an example of a config.gem command too. For now I know that rails and/or ActiveRecord expects to find the SQL Server adapter in the vendor/plugins/adapters/sqlserver folder of your rails project.
3843

3944
$ sudo gem install rails-sqlserver-2000-2005-adapter
@@ -58,12 +63,12 @@ There is also a #rails-sqlserver channel on irc.freenode.net if you want to disc
5863

5964
== Credits
6065

61-
Many many people have contributed. If you do not see your name here and it should be let me know.
66+
Many many people have contributed. If you do not see your name here and it should be let us know.
6267

63-
* Ken Collins
64-
* Murray Steele
65-
* Shawn Balestracci
66-
* Tom Ward
68+
* Ken Collins
69+
* Murray Steele
70+
* Shawn Balestracci
71+
* Tom Ward
6772

6873

6974
== License

0 commit comments

Comments
 (0)