<commit_before>
== Rails SQL Server 2000 & 2005 Adapter

The SQL Server adapter for rails is back for ActiveRecord 2.2 and up! We are currently passing all tests and hope to continue to do so moving forward. 


== What's New

  * Enabled support for DDL transactions.
  * Micro second support. Time#usec is automatically converted to SQL Server's 3.33 millisecond limitation.
  * Datetime data type before type casting are represented correctly. For example: 1998-01-01 23:59:59.997
  * Implementation for #disable_referential_integrity used by ActiveRecord::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 date types.



==== Native Text Datetype Accessor

native_text_database_type

'varchar(max)' : 'text'

==== Date/Time Datatype Hinting



  class Topic < ActiveRecord::Base
    coerce_sqlserver_date :last_read
    coerce_sqlserver_time :bonus_time
  end


== Installation
  
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.

  $ sudo gem install rails-sqlserver-2000-2005-adapter

Ruby DBI is required and to my knowledge the ADO DBD driver is no longer supported, meaning that ODBC is the only way to go. During development ancient versions of DBI back to 0.0.23 were tested along with the current latest 0.4.0 version. Because later versions of DBI will be changing many things, IT IS HIGHLY RECOMMENDED that you install 0.4.0 which the examples below show. This is not a compressive how to since ODBC mode requires also that you install Ruby ODBC and possibly FreeTDS.

  $ sudo gem install dbi --version 0.4.0
  $ sudo gem install dbd-odbc --version 0.2.4

Optionally configure your gem dependencies in your rails environment.rb file.

  config.gem 'dbi', :version => '0.4.0'
  config.gem 'dbd-odbc', :version => '0.2.4', :lib => 'dbd/ODBC'


== Contributing

Please read the RUNNING_UNIT_TESTS file for the details of how to run the unit tests. Bugs can be reported to our lighthouse page at http://rails-sqlserver.lighthouseapp.com/projects/20277-sql-server-05-adapter/overview

There is also a #rails-sqlserver channel on irc.freenode.net if you want to discuss any topics about the adapter.


== Credits

Many many people have contributed. If you do not see your name here and it should be let me know.

  * <NAME>
  * <NAME>
  * <NAME>
  * <NAME>


== License

Copyright © 2008. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
<commit_msg>Adding more info about what's new in this version.<commit_after>
== Rails SQL Server 2000 & 2005 Adapter

The SQL Server adapter for rails is back for ActiveRecord 2.2 and up! We are currently passing all tests and hope to continue to do so moving forward. 


== What's New

* 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::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.

==== Native Text Data Type Accessor

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.

* SQL Server 2000 is 'text'
* SQL Server 2005 is 'varchar(max)'

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.

  ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_text_database_type = 'varchar(8000)'

==== Date/Time Data Type Hinting

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.

  class Topic < ActiveRecord::Base
    coerce_sqlserver_date :last_read
    coerce_sqlserver_time :bonus_time
  end

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.


== Installation

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.

  $ sudo gem install rails-sqlserver-2000-2005-adapter

Ruby DBI is required and to my knowledge the ADO DBD driver is no longer supported, meaning that ODBC is the only way to go. During development ancient versions of DBI back to 0.0.23 were tested along with the current latest 0.4.0 version. Because later versions of DBI will be changing many things, IT IS HIGHLY RECOMMENDED that you install 0.4.0 which the examples below show. This is not a compressive how to since ODBC mode requires also that you install Ruby ODBC and possibly FreeTDS.

  $ sudo gem install dbi --version 0.4.0
  $ sudo gem install dbd-odbc --version 0.2.4

Optionally configure your gem dependencies in your rails environment.rb file.

  config.gem 'dbi', :version => '0.4.0'
  config.gem 'dbd-odbc', :version => '0.2.4', :lib => 'dbd/ODBC'


== Contributing

Please read the RUNNING_UNIT_TESTS file for the details of how to run the unit tests. Bugs can be reported to our lighthouse page at http://rails-sqlserver.lighthouseapp.com/projects/20277-sql-server-05-adapter/overview

There is also a #rails-sqlserver channel on irc.freenode.net if you want to discuss any topics about the adapter.


== Credits

Many many people have contributed. If you do not see your name here and it should be let us know.

* <NAME>
* <NAME>
* <NAME>
* <NAME>


== License

Copyright © 2008. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

{'fraction_non_alphanumeric': 0.05792140216349445, 'fraction_numerical': 0.02382582500342325, 'mean_word_length': 4.191186922530206, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2516633', 'n_tokens_mistral': 2161, 'n_tokens_neox': 1956, 'n_words': 1032}