# File lib/arjdbc/mssql/column.rb, line 166 def binary_to_string(value) if value.respond_to?(:force_encoding) && value.encoding != Encoding::ASCII_8BIT value = value.force_encoding(Encoding::ASCII_8BIT) end value =~ /[^[:xdigit:]]/ ? value : [value].pack('H*') end
# File lib/arjdbc/mssql/column.rb, line 160 def string_to_binary(value) # this will only allow the adapter to insert binary data with a length # of 7K or less because of a SQL Server statement length policy ... "0x#{value.unpack("H*")}" # "0x#{value.unpack("H*")[0]}" end
# File lib/arjdbc/mssql/column.rb, line 131 def string_to_date(value) return value unless value.is_a?(String) return nil if value.empty? date = fast_string_to_date(value) date ? date : Date.parse(value) rescue nil end
# File lib/arjdbc/mssql/column.rb, line 148 def string_to_dummy_time(value) return value unless value.is_a?(String) return nil if value.empty? if value =~ ISO_TIME # "12:34:56.1234560" microsec = ($4.to_f * 1_000_000).round.to_i new_time 2000, 1, 1, $1.to_i, $2.to_i, $3.to_i, microsec else super(value) end end
Generated with the Darkfish Rdoc Generator 2.