File tree Expand file tree Collapse file tree 2 files changed +30
-10
lines changed
lib/active_record/connection_adapters/sqlserver Expand file tree Collapse file tree 2 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,14 @@ module Quoting
1010
1111 def fetch_type_metadata ( sql_type , sqlserver_options = { } )
1212 cast_type = lookup_cast_type ( sql_type )
13- SQLServer :: SqlTypeMetadata . new (
13+ simple_type = SqlTypeMetadata . new (
1414 sql_type : sql_type ,
1515 type : cast_type . type ,
1616 limit : cast_type . limit ,
1717 precision : cast_type . precision ,
18- scale : cast_type . scale ,
19- sqlserver_options : sqlserver_options
18+ scale : cast_type . scale
2019 )
20+ SQLServer ::TypeMetadata . new ( simple_type , sqlserver_options : sqlserver_options )
2121 end
2222
2323 def quote_string ( s )
Original file line number Diff line number Diff line change 33module ActiveRecord
44 module ConnectionAdapters
55 module SQLServer
6- class SqlTypeMetadata < ActiveRecord ::ConnectionAdapters ::SqlTypeMetadata
7- def initialize ( **kwargs )
8- @sqlserver_options = kwargs . extract! ( :sqlserver_options )
9- super ( **kwargs )
6+ class TypeMetadata < DelegateClass ( SqlTypeMetadata )
7+ undef to_yaml if method_defined? ( :to_yaml )
8+
9+ include Deduplicable
10+
11+ attr_reader :sqlserver_options
12+
13+ def initialize ( type_metadata , sqlserver_options : nil )
14+ super ( type_metadata )
15+ @sqlserver_options = sqlserver_options
16+ end
17+
18+ def ==( other )
19+ other . is_a? ( TypeMetadata ) &&
20+ __getobj__ == other . __getobj__ &&
21+ sqlserver_options == other . sqlserver_options
22+ end
23+ alias eql? ==
24+
25+ def hash
26+ TypeMetadata . hash ^
27+ __getobj__ . hash ^
28+ sqlserver_options . hash
1029 end
1130
12- protected
31+ private
1332
14- def attributes_for_hash
15- super + [ @sqlserver_options ]
33+ def deduplicated
34+ __setobj__ ( __getobj__ . deduplicate )
35+ super
1636 end
1737 end
1838 end
You can’t perform that action at this time.
0 commit comments