File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
lib/active_record/connection_adapters Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,6 @@ module SQLServer
44 module Type
55 class Time < ActiveRecord ::Type ::Time
66
7- # Default fractional scale for 'time' (See https://docs.microsoft.com/en-us/sql/t-sql/data-types/time-transact-sql)
8- DEFAULT_FRACTIONAL_SCALE = 7
9-
107 include TimeValueFractional2
118
129 def serialize ( value )
@@ -45,7 +42,7 @@ def cast_value(value)
4542 end
4643
4744 def fractional_scale
48- precision || DEFAULT_FRACTIONAL_SCALE
45+ precision
4946 end
5047
5148 end
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ class SQLServerAdapter < AbstractAdapter
4141
4242 ADAPTER_NAME = 'SQLServer' . freeze
4343
44+ # Default precision for 'time' (See https://docs.microsoft.com/en-us/sql/t-sql/data-types/time-transact-sql)
45+ DEFAULT_TIME_PRECISION = 7
46+
4447 attr_reader :spid
4548
4649 cattr_accessor :cs_equality_operator , instance_accessor : false
@@ -297,8 +300,7 @@ def initialize_type_map(m = type_map)
297300 end
298301 m . register_type 'smalldatetime' , SQLServer ::Type ::SmallDateTime . new
299302 m . register_type %r{\A time}i do |sql_type |
300- scale = extract_scale ( sql_type )
301- precision = extract_precision ( sql_type )
303+ precision = extract_precision ( sql_type ) || DEFAULT_TIME_PRECISION
302304 SQLServer ::Type ::Time . new precision : precision
303305 end
304306 # Character Strings
You can’t perform that action at this time.
0 commit comments