Skip to content

Conversation

@wbond
Copy link
Contributor

@wbond wbond commented May 16, 2014

Tests all successfully run with Rail 4.1.2. Started with rails-4-1-0 branch and rebased it all on the latest master.

The commit messages should pretty well document why changes were made.

Anna Carey and others added 17 commits May 16, 2014 14:54
removing duplicate standard_dump
…fixed bind parameter tests to work with SQL server
…lt in that the SQL was embedded in a call to sp_executesql, which seems ok to me
…ection_handler_test.rb by setting the RAILS_ENV to 'default_env'
…est_create_table_with_query and MigrationTest#test_create_table_with_query_from_relation
…hed negative response - fixes test ActiveRecord::Migration::ChangeSchemaTest#test_change_column_null
…hat ActiveRecord::Relation merging works properly - tests RelationMergingTest#test_merging_reorders_bind_params and RelationMergingTest#test_relation_to_sql
…new_handlers since the regex doesn't work for T-SQL
…n_defined by adding a second column to the ORDER BY condition of the :ranked_by_comments scope of the Post model
@sixfeetover
Copy link
Contributor

Awesome work!

annaswims added a commit that referenced this pull request May 18, 2014
@annaswims annaswims merged commit 8bccbaa into rails-sqlserver:master May 18, 2014
@annaswims
Copy link
Contributor

Wow, this is great! I'm so glad you did this.

@muloka
Copy link
Contributor

muloka commented May 19, 2014

@wbond You're work on this is awesome.

I'm running all the tests now and many are now passing though unfortunately not all of them pass. Anyone else have a passing test suite?

This is what I used to test:

bundle exec rake test ACTIVERECORD_UNITTEST_HOST='sqlserver_ip'

Did I miss something? Got any tips? You mentioned Rails 4.1.2 though only 4.1.1 has been released.

Thank you.

@wbond
Copy link
Contributor Author

wbond commented May 19, 2014

@muloka What failures are you seeing?

@muloka
Copy link
Contributor

muloka commented May 19, 2014

4695 runs, 11979 assertions, 2 failures, 89 errors, 2 skips

All of the errors were related to either or both of these:

  • TinyTds::Error: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
  • TinyTds::Error: Cannot issue SAVE TRANSACTION when there is no active transaction

As for the two failed tests:

 90) Failure:
ActiveRecord::Migration::ColumnAttributesTest#test_native_types [/home/muloka/.rvm/gems/ruby-2.1.2/bundler/gems/rails-65b146cad691/activerecord/test/cases/migration/column_attributes_test.rb:159]:
Expected: Date
  Actual: Time


 91) Failure:
HasManyAssociationsTest#test_0005_anonymous [/home/muloka/.rvm/gems/ruby-2.1.2/bundler/gems/rails-65b146cad691/activerecord/test/cases/associations/has_many_associations_test.rb:1746]:
1 instead of 0 queries were executed.
Queries:
EXEC sp_executesql N' SELECT DISTINCT columns.TABLE_NAME AS table_name, columns.COLUMN_NAME AS name, columns.DATA_TYPE AS type, columns.COLUMN_DEFAULT AS default_value, columns.NUMERIC_SCALE AS numeric_scale, columns.NUMERIC_PRECISION AS numeric_precision, columns.ordinal_position, CASE WHEN columns.DATA_TYPE IN (''nchar'',''nvarchar'') THEN columns.CHARACTER_MAXIMUM_LENGTH ELSE COL_LENGTH(''''+columns.TABLE_SCHEMA+''.''+columns.TABLE_NAME, columns.COLUMN_NAME) END AS [length], CASE WHEN columns.IS_NULLABLE = ''YES'' THEN 1 ELSE NULL END AS [is_nullable], CASE WHEN KCU.COLUMN_NAME IS NOT NULL AND TC.CONSTRAINT_TYPE = N''PRIMARY KEY'' THEN 1 ELSE NULL END AS [is_primary], c.is_identity AS [is_identity] FROM INFORMATION_SCHEMA.COLUMNS columns LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC ON TC.TABLE_NAME = columns.TABLE_NAME AND TC.CONSTRAINT_TYPE = N''PRIMARY KEY'' LEFT OUTER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KCU ON KCU.COLUMN_NAME = columns.COLUMN_NAME AND KCU.CONSTRAINT_NAME = TC.CONSTRAINT_NAME AND KCU.CONSTRAINT_CATALOG = TC.CONSTRAINT_CATALOG AND KCU.CONSTRAINT_SCHEMA = TC.CONSTRAINT_SCHEMA INNER JOIN .sys.schemas AS s ON s.name = columns.TABLE_SCHEMA AND s.schema_id = s.schema_id INNER JOIN .sys.objects AS o ON s.schema_id = o.schema_id AND o.is_ms_shipped = 0 AND o.type IN (''U'', ''V'') AND o.name = columns.TABLE_NAME INNER JOIN .sys.columns AS c ON o.object_id = c.object_id AND c.name = columns.COLUMN_NAME WHERE columns.TABLE_NAME = @0 AND columns.TABLE_SCHEMA = schema_name() ORDER BY columns.ordinal_position ', N'@0 nvarchar(max)', @0 = N'comments'.
Expected: 0
  Actual: 1

@wbond
Copy link
Contributor Author

wbond commented May 19, 2014

@muloka I just ran the tests with Rails 4.1.1 on ruby 2.0.0p247 and 2.1.2 and got zero errors. I should mention though, that I do not have odbc set up or installed on my machine. Do you see any different results running:

bundle exec rake test:dblib ACTIVERECORD_UNITTEST_HOST='sqlserver_ip'

@muloka
Copy link
Contributor

muloka commented May 19, 2014

@wbond I just ran the tests in this environment using dblib and I got the same failures and errors:

  • ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
  • Rails 4.1.1
  • Microsoft SQL Server 2005 - 9.00.4035.00 (X64)
  • rails-sqlserver/activerecord-sqlserver-adapter [branch:master]

Could it be that my version of SQL Server is too old?

@wbond
Copy link
Contributor Author

wbond commented May 19, 2014

Ah, yes. Server 2005 doesn't have some date-related features. My guess is that there are some incompatibilities with certain transaction features. Unfortunately I don't have SQL Server 2005 to test with, or really the desire to do so. :-\

@muloka
Copy link
Contributor

muloka commented May 19, 2014

@wbond I don't blame you in the slightest.

@muloka
Copy link
Contributor

muloka commented May 19, 2014

And thanks for your help!

@muloka
Copy link
Contributor

muloka commented May 27, 2014

Just an FYI...

Was able to finally obtain SQL Server 2012 and run the test suite. Everything passes. Hoorah!

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants