diff --git a/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb b/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb index 66175fcb2..c77b27df4 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb @@ -7,10 +7,12 @@ module Quoting # QUOTING ================================================== # # see: abstract/quoting.rb + QUOTED_COLUMN_NAMES = Concurrent::Map.new # :nodoc: + QUOTED_TABLE_NAMES = Concurrent::Map.new # :nodoc: def quote_column_name(name) # :nodoc: name = name.to_s - self.class.quoted_column_names[name] ||= if /\A[a-z][a-z_0-9$#]*\Z/.match?(name) + QUOTED_COLUMN_NAMES[name] ||= if /\A[a-z][a-z_0-9$#]*\Z/.match?(name) "\"#{name.upcase}\"" else # remove double quotes which cannot be used inside quoted identifier @@ -26,7 +28,7 @@ def quote_column_name_or_expression(name) # :nodoc: # if only valid lowercase column characters in name when /^[a-z][a-z_0-9$#]*$/ "\"#{name.upcase}\"" - when /^[a-z][a-z_0-9$#\-]*$/i + when /^[a-z][a-z_0-9$#-]*$/i "\"#{name}\"" # if other characters present then assume that it is expression # which should not be quoted @@ -67,7 +69,7 @@ def self.mixed_case?(name) def quote_table_name(name) # :nodoc: name, _link = name.to_s.split("@") - self.class.quoted_table_names[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".") + QUOTED_TABLE_NAMES[name] ||= [name.split(".").map { |n| quote_column_name(n) }].join(".") end def quote_string(s) # :nodoc: diff --git a/spec/active_record/oracle_enhanced/type/custom_spec.rb b/spec/active_record/oracle_enhanced/type/custom_spec.rb index e7e50a84c..bcc04feda 100644 --- a/spec/active_record/oracle_enhanced/type/custom_spec.rb +++ b/spec/active_record/oracle_enhanced/type/custom_spec.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "base64" + describe "OracleEnhancedAdapter custom types handling" do include SchemaSpecHelper