File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
lib/active_record/connection_adapters/sqlserver Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -331,11 +331,7 @@ def sp_executesql_types_and_parameters(binds)
331331 def sp_executesql_sql_type ( attr )
332332 return attr . type . sqlserver_type if attr . respond_to? ( :type ) && attr . type . respond_to? ( :sqlserver_type )
333333
334- value = if attr . is_a? ( Symbol ) || attr . is_a? ( String ) || attr . is_a? ( Numeric )
335- attr
336- else
337- attr . value_for_database
338- end
334+ value = basic_attribute_type? ( attr ) ? attr : attr . value_for_database
339335
340336 if value . is_a? ( Numeric )
341337 value > 2_147_483_647 ? "bigint" . freeze : "int" . freeze
@@ -345,7 +341,7 @@ def sp_executesql_sql_type(attr)
345341 end
346342
347343 def sp_executesql_sql_param ( attr )
348- return quote ( attr ) if attr . is_a? ( Symbol ) || attr . is_a? ( String ) || attr . is_a? ( Numeric )
344+ return quote ( attr ) if basic_attribute_type? ( attr )
349345
350346 case value = attr . value_for_database
351347 when Type ::Binary ::Data , ActiveRecord ::Type ::SQLServer ::Data
@@ -355,6 +351,15 @@ def sp_executesql_sql_param(attr)
355351 end
356352 end
357353
354+ def basic_attribute_type? ( type )
355+ type . is_a? ( Symbol ) ||
356+ type . is_a? ( String ) ||
357+ type . is_a? ( Numeric ) ||
358+ type . is_a? ( Time ) ||
359+ type . is_a? ( TrueClass ) ||
360+ type . is_a? ( FalseClass )
361+ end
362+
358363 def sp_executesql_sql ( sql , types , params , name )
359364 if name == "EXPLAIN"
360365 params . each . with_index do |param , index |
You can’t perform that action at this time.
0 commit comments