Skip to content

Development Environment on Windows

KDGundermann edited this page Sep 13, 2010 · 23 revisions

I tried to test the adapter on Windows and thought it would be a good idea to document my steps.
I didn’t know where to put my documentation, so I created a new entry here in the wiki.
( please tell me if I should put these information elsewhere .. maybe I should create an Issue ?)
-———————————
- Testing sqlserver-adapter 3.0.0.beta1 with rails v3.0.0.beta4 on Windows XP on SQL Server 2005 (German)


24.06.2010

>>ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]

>> cd \
>> mkdir \RailsTest
>> cd \RailsTest
>> rails rails3test

>> git clone git://github.com/rails/rails.git rails3test/vendor/rails
>> git clone git://github.com/rails-sqlserver/2000-2005-adapter.git rails3/vendor/plugins/adapters/sqlserver
>> git clone git://github.com/rails-sqlserver/arel.git rails3test/vendor/arel

>> cd rails3test
>> cd arel
>> git checkout origin/sqlserver

>> cd vendor\plugings\adapters\sqlserver
>> git branch adapter_test_on_windows
>> git checkout adapter_test_on_windows

>> set RAILS_SOURCE=../../../rails # see sqlserver_helper.rb
>> set AREL_SOURCE=../../../arel

>> gem install bundler
>> gem install shoulda —version 2.10.3
>> gem install tzinfo
>> gem install i18n

>> [ Insert gem ‘ruby-odbc’ in gemfile ]

>> rake test

C:/RailsTest/rails3test/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:211:in `rescue in log’: ODBC::Er
ror: 37000 (2750) [Microsoft][SQL Native Client][SQL Server]Spalte oder Parameter Nr. 8: Die angegebene Spaltengenauigkeit 55 ist gr÷▀er als die maximale Genauigkeit 38.: CREATE TABLE [numeric_data] ([id] int NOT NULL IDENTITY PRIMARY KEY, [bank_balance] decimal(10,2), [big_bank_balance] decimal(15,2), [world_population] decimal(10,0), [my_house_population] decimal(2,0), [decimal_number_with_default] decimal(3,2) DEFAULT 2.78, [temperature] float(8), [atoms_in_universe] decimal(55,0)) (ActiveRecord::StatementInvalid)

decimal only allows 38 digits on SQL Server 2005
changed in
C:\RailsTest\rails3test\vendor\rails\activerecord\test\schema\schema.rb

diff -git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index b212e7c..5f87898 100644
-
- a/activerecord/test/schema/schema.rb
+ b/activerecord/test/schema/schema.rb
@ -313,8 +313,8 @ ActiveRecord::Schema.define do
t.decimal :my_house_population, :precision => 2, :scale => 0
t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
t.float :temperature
- # Oracle supports precision up to 38
- if current_adapter?(:OracleAdapter)
+ # Oracle and Microsoft supports precision up to 38
+ if current_adapter?(:OracleAdapter) || current_adapter?(:SQLServerAdapter)
t.decimal :atoms_in_universe, :precision => 38, :scale => 0
else
t.decimal :atoms_in_universe, :precision => 55, :scale => 0


25.06.2010

rake test

1) Error:

test: For DatabaseStatements altering isolation levels should barf if the requested isolation level is not valid. (AdapterTestSqlserver):
ActiveRecord::StatementInvalid: ODBC::Error: 22008 (242) [Microsoft][SQL Native Client][SQL Server]Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs.: INSERT INTO [tasks] ([id], [starting], [ending]) VALUES (1, ‘2005-03-30 07:30:00.000’, ‘2005-03-30 09:30:00.000’)
..
C:/RailsTest/rails3test/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:239:in `insert_fixture’

Clone this wiki locally