File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed
lib/active_record/connection_adapters Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -332,24 +332,13 @@ def sqlserver_2005?
332332 # QUOTING ==================================================#
333333
334334 def quote ( value , column = nil )
335- return value . quoted_id if value . respond_to? ( :quoted_id )
336- case value
337- when String , ActiveSupport ::Multibyte ::Chars
338- value = value . to_s
339- # for binary columns, don't quote the result of the string to binary
340- return column . class . string_to_binary ( value ) if column && column . type == :binary && column . class . respond_to? ( :string_to_binary )
341- super
342- else
343- if value . acts_like? ( :time )
344- "'#{ value . strftime ( "%Y%m%d %H:%M:%S" ) } '"
345- elsif value . acts_like? ( :date )
346- "'#{ value . strftime ( "%Y%m%d" ) } '"
347- else
348- super
349- end
335+ if value . kind_of? ( String ) && column && column . type == :binary
336+ column . class . string_to_binary ( value )
337+ else
338+ super
350339 end
351340 end
352-
341+
353342 def quote_string ( string )
354343 string . gsub ( /\' / , "''" )
355344 end
@@ -383,6 +372,17 @@ def quoted_false
383372 '0'
384373 end
385374
375+ # TODO: I get the feeling this needs to go and that it is patching something else wrong.
376+ def quoted_date ( value )
377+ if value . acts_like? ( :time )
378+ value . strftime ( "%Y%m%d %H:%M:%S" )
379+ elsif value . acts_like? ( :date )
380+ value . strftime ( "%Y%m%d" )
381+ else
382+ super
383+ end
384+ end
385+
386386 # REFERENTIAL INTEGRITY ====================================#
387387 # TODO: Add #disable_referential_integrity if we can use it
388388
You can’t perform that action at this time.
0 commit comments