Skip to content

Commit eb9fa33

Browse files
authored
Merge pull request #2346 from yahonda/diag48773
Make ActiveRecord's quoted name caches thread-safe on JRuby/TruffleRuby
2 parents 3eb404e + 76db60b commit eb9fa33

File tree

1 file changed

+4
-2
lines changed
  • lib/active_record/connection_adapters/oracle_enhanced

1 file changed

+4
-2
lines changed

lib/active_record/connection_adapters/oracle_enhanced/quoting.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ module Quoting
77
# QUOTING ==================================================
88
#
99
# see: abstract/quoting.rb
10+
QUOTED_COLUMN_NAMES = Concurrent::Map.new # :nodoc:
11+
QUOTED_TABLE_NAMES = Concurrent::Map.new # :nodoc:
1012

1113
def quote_column_name(name) # :nodoc:
1214
name = name.to_s
13-
self.class.quoted_column_names[name] ||= if /\A[a-z][a-z_0-9$#]*\Z/.match?(name)
15+
QUOTED_COLUMN_NAMES[name] ||= if /\A[a-z][a-z_0-9$#]*\Z/.match?(name)
1416
"\"#{name.upcase}\""
1517
else
1618
# remove double quotes which cannot be used inside quoted identifier
@@ -67,7 +69,7 @@ def self.mixed_case?(name)
6769

6870
def quote_table_name(name) # :nodoc:
6971
name, _link = name.to_s.split("@")
70-
self.class.quoted_table_names[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".")
72+
QUOTED_TABLE_NAMES[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".")
7173
end
7274

7375
def quote_string(s) # :nodoc:

0 commit comments

Comments
 (0)