# File lib/dbd/Pg.rb, line 67 67: def self.generate_array(obj) 68: # XXX yarr, there be recursion here, and it's probably not a good idea. 69: output = "{" 70: obj.each do |item| 71: case item 72: when ::Array 73: output += generate_array(item) 74: else 75: generated = DBI::TypeUtil.convert(driver_name, item) 76: generated = case item 77: when String 78: # in strings, escapes are doubled and the quotes are different. 79: # this gets *really* ugly and needs to be well-tested 80: "\"#{generated.gsub(/\\/) { "\\\\" }}\"" 81: when Fixnum 82: generated.to_s 83: end 84: output += generated 85: end 86: output += "," # FIXME technically, delimiters are variable 87: end 88: 89: output.sub(/,$/, '}') 90: end