Title: [1005] trunk/activerecord-jdbc: - 20243: numerics improvements for MSSQL ( Aslak Helles?\195?\184y)
Revision
1005
Author
nicksieger
Date
2008-06-03 23:16:37 -0400 (Tue, 03 Jun 2008)

Log Message

- 20243: numerics improvements for MSSQL (Aslak Helles?\195?\184y)

Modified Paths


Diff

Modified: trunk/activerecord-jdbc/History.txt (1004 => 1005)


--- trunk/activerecord-jdbc/History.txt	2008-06-04 03:16:31 UTC (rev 1004)
+++ trunk/activerecord-jdbc/History.txt	2008-06-04 03:16:37 UTC (rev 1005)
@@ -10,6 +10,7 @@
 - JRUBY-2011: Fix MSSQL string un-quoting issue (Silvio Fonseca)
 - JRUBY-1977, 17427: Fix information_schema select issue with MSSQL (Matt Burke)
 - 20479: Improve get_table_name for MSSQL (Aslak Hellesøy)
+- 20243: numerics improvements for MSSQL (Aslak Hellesøy)
 
 == 0.8
 

Modified: trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mssql.rb (1004 => 1005)


--- trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mssql.rb	2008-06-04 03:16:31 UTC (rev 1004)
+++ trunk/activerecord-jdbc/lib/jdbc_adapter/jdbc_mssql.rb	2008-06-04 03:16:37 UTC (rev 1005)
@@ -37,7 +37,8 @@
       def simplified_type(field_type)
         case field_type
           when /int|bigint|smallint|tinyint/i                        then :integer
-          when /float|double|decimal|money|numeric|real|smallmoney/i then @scale == 0 ? :integer : :decimal
+          when /numeric/i                                            then (@scale.nil? || @scale == 0) ? :integer : :decimal
+          when /float|double|decimal|money|real|smallmoney/i         then :decimal
           when /datetime|smalldatetime/i                             then :datetime
           when /timestamp/i                                          then :timestamp
           when /time/i                                               then :time

Modified: trunk/activerecord-jdbc/test/models/entry.rb (1004 => 1005)


--- trunk/activerecord-jdbc/test/models/entry.rb	2008-06-04 03:16:31 UTC (rev 1004)
+++ trunk/activerecord-jdbc/test/models/entry.rb	2008-06-04 03:16:37 UTC (rev 1005)
@@ -7,7 +7,7 @@
       t.column :title, :string, :limit => 100
       t.column :updated_on, :datetime
       t.column :content, :text
-      t.column :rating, :decimal, :precision => 10
+      t.column :rating, :decimal, :precision => 10, :scale => 2
     end
   end
 

Modified: trunk/activerecord-jdbc/test/simple.rb (1004 => 1005)


--- trunk/activerecord-jdbc/test/simple.rb	2008-06-04 03:16:31 UTC (rev 1004)
+++ trunk/activerecord-jdbc/test/simple.rb	2008-06-04 03:16:37 UTC (rev 1005)
@@ -22,7 +22,7 @@
     @title = "First post!"
     @content = "Hello from JRuby on Rails!"
     @new_title = "First post updated title"
-    @rating = 205
+    @rating = 205.76
     Entry.create :title => @title, :content => @content, :rating => @rating
   end
 end
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to