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
4
4
module Type
5
5
class Time < ActiveRecord ::Type ::Time
6
6
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
-
10
7
include TimeValueFractional2
11
8
12
9
def serialize ( value )
@@ -45,7 +42,7 @@ def cast_value(value)
45
42
end
46
43
47
44
def fractional_scale
48
- precision || DEFAULT_FRACTIONAL_SCALE
45
+ precision
49
46
end
50
47
51
48
end
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ class SQLServerAdapter < AbstractAdapter
41
41
42
42
ADAPTER_NAME = 'SQLServer' . freeze
43
43
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
+
44
47
attr_reader :spid
45
48
46
49
cattr_accessor :cs_equality_operator , instance_accessor : false
@@ -297,8 +300,7 @@ def initialize_type_map(m = type_map)
297
300
end
298
301
m . register_type 'smalldatetime' , SQLServer ::Type ::SmallDateTime . new
299
302
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
302
304
SQLServer ::Type ::Time . new precision : precision
303
305
end
304
306
# Character Strings
You can’t perform that action at this time.
0 commit comments