Skip to content

Commit 311eb92

Browse files
committed
In AR5.1 and up method quote takes in 1 parameter. Dropped the column param and related code
1 parent 5eb2d92 commit 311eb92

File tree

1 file changed

+2
-51
lines changed

1 file changed

+2
-51
lines changed

lib/arjdbc/db2/adapter.rb

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -401,60 +401,11 @@ def pk_and_sequence_for(table)
401401

402402
# Properly quotes the various data types.
403403
# @param value contains the data
404-
# @param column (optional) contains info on the field
405404
# @override
406-
def quote(value, column = nil)
407-
return value.quoted_id if value.respond_to?(:quoted_id)
405+
def quote(value)
408406
return value if sql_literal?(value)
409407

410-
if column
411-
if column.respond_to?(:primary) && column.primary && column.klass != String
412-
return value.to_i.to_s
413-
end
414-
if value && (column.type.to_sym == :decimal || column.type.to_sym == :integer)
415-
return value.to_s
416-
end
417-
end
418-
419-
column_type = column && column.type.to_sym
420-
421-
case value
422-
when nil then 'NULL'
423-
when Numeric # IBM_DB doesn't accept quotes on numeric types
424-
# if the column type is text or string, return the quote value
425-
if column_type == :text || column_type == :string
426-
"'#{value}'"
427-
else
428-
value.to_s
429-
end
430-
when String, ActiveSupport::Multibyte::Chars
431-
if column_type == :binary && column.sql_type !~ /for bit data/i
432-
if update_lob_value?(value, column)
433-
value.nil? ? 'NULL' : BLOB_VALUE_MARKER # '@@@IBMBINARY@@@'"
434-
else
435-
"BLOB('#{quote_string(value)}')"
436-
end
437-
elsif column && column.sql_type =~ /clob/ # :text
438-
if update_lob_value?(value, column)
439-
value.nil? ? 'NULL' : CLOB_VALUE_MARKER # "'@@@IBMTEXT@@@'"
440-
else
441-
"'#{quote_string(value)}'"
442-
end
443-
elsif column_type == :xml
444-
value.nil? ? 'NULL' : "'#{quote_string(value)}'" # "'<ibm>@@@IBMXML@@@</ibm>'"
445-
else
446-
"'#{quote_string(value)}'"
447-
end
448-
when Symbol then "'#{quote_string(value.to_s)}'"
449-
when Time
450-
# AS400 doesn't support date in time column
451-
if column_type == :time
452-
quote_time(value)
453-
else
454-
super
455-
end
456-
else super
457-
end
408+
super
458409
end
459410

460411
# @override

0 commit comments

Comments
 (0)