Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,13 @@ def sp_executesql_types_and_parameters(binds)

def sp_executesql_sql_type(attr)
if attr.respond_to?(:type)
return attr.type.sqlserver_type if attr.type.respond_to?(:sqlserver_type)
type = attr.type.is_a?(ActiveRecord::Normalization::NormalizedValueType) ? attr.type.cast_type : attr.type
type = type.subtype if type.serialized?

if attr.type.is_a?(ActiveRecord::Encryption::EncryptedAttributeType) && attr.type.instance_variable_get(:@cast_type).respond_to?(:sqlserver_type)
return attr.type.instance_variable_get(:@cast_type).sqlserver_type
return type.sqlserver_type if type.respond_to?(:sqlserver_type)

if type.is_a?(ActiveRecord::Encryption::EncryptedAttributeType) && type.instance_variable_get(:@cast_type).respond_to?(:sqlserver_type)
return type.instance_variable_get(:@cast_type).sqlserver_type
end
end

Expand Down
Loading