Monday, December 8, 2008

New rails 2.2.Sql Server adapter

There is a new SQL-Server adapter for active-record. The new features are the following :

- Enabled support for DDL transactions.
- Micro second support. Time#usec is automatically converted to SQL Server's 3.33 millisecond limitation.
- Datetime data types before type casting are represented correctly. For example: 1998-01-01 23:59:59.997
- Implementation for #disable_referential_integrity used by ActiveRecord's Fixtures class.
- Pessimistic locking suppot. See the #add_lock! method for details.
- Enabled #case_sensitive_equality_operator used by unique validations.
- Unicode character support for nchar, nvarchar and ntext data types.
- View support for table names, identity inserts, and column defaults.

to install it :

gem install rails-sqlserver-2000-2005-adapter -s http://gems.github.com

More info on article on railsinside.com or get the code on git

Update : After some tests I can confirm it does not function with SQL Server 2008, so stick to the normal adapter mentionned in my previous post if you are running SQL Server 2008 if you want to avoid the nice message saying "Currently only 2000 and 2005 are supported". Somehow frustrating if you have 2008 !

New Update : It seems that there is a workaround ! You can play with the constant SUPPORTED_VERSIONS by adding 2008 to it. The reason why it is not officially supported is that the author would like to rewrite the code to take advantage of the new features of SQL Server 2008. I can only thank him for this idea, let's hope the wait won't be too long !

By the way, this adapter is now also tested and improved for rails 2.3.2