Skip to content

Commit 0c6ba87

Browse files
committed
Make sure bigint SQL Server data type can be used and converted back to Bignum as expected.
1 parent 3f2ce55 commit 0c6ba87

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/cases/specific_schema_test_sqlserver.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,24 @@ class SpecificSchemaTestSqlserver < ActiveRecord::TestCase
5050

5151
end
5252

53+
context 'with bigint column' do
5354

55+
setup do
56+
@b5k = 5000
57+
@bi5k = @edge_class.create! :bigint => @b5k, :description => 'Five Thousand'
58+
@bnum = 9_000_000_000_000_000_000
59+
@bimjr = @edge_class.create! :bigint => @bnum, :description => 'Close to max bignum'
60+
end
61+
62+
should 'can find by biginit' do
63+
assert_equal @bi5k, @edge_class.find_by_bigint(@b5k)
64+
assert_equal @b5k, @edge_class.find(:first, :select => 'bigint', :conditions => {:bigint => @b5k}).bigint
65+
assert_equal @bimjr, @edge_class.find_by_bigint(@bnum)
66+
assert_equal @bnum, @edge_class.find(:first, :select => 'bigint', :conditions => {:bigint => @bnum}).bigint
67+
end
68+
69+
end
70+
5471
end
5572

5673

test/schema/sqlserver_specific_schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464

6565
create_table :sql_server_edge_schemas, :force => true do |t|
6666
t.string :description
67+
t.column :bigint, :bigint
6768
end
6869

6970
execute "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'customers_view') DROP VIEW customers_view"

0 commit comments

Comments
 (0)